Changeset 42343 for trunk/tests/phpunit/includes/bootstrap.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/bootstrap.php
r42228 r42343 14 14 if ( ! file_exists( $config_file_path . '/wp-tests-config.php' ) ) { 15 15 // Support the config file from the root of the develop repository. 16 if ( basename( $config_file_path ) === 'phpunit' && basename( dirname( $config_file_path ) ) === 'tests' ) 16 if ( basename( $config_file_path ) === 'phpunit' && basename( dirname( $config_file_path ) ) === 'tests' ) { 17 17 $config_file_path = dirname( dirname( $config_file_path ) ); 18 } 18 19 } 19 20 $config_file_path .= '/wp-tests-config.php'; … … 39 40 define( 'WP_LANG_DIR', DIR_TESTDATA . '/languages' ); 40 41 41 if ( ! defined( 'WP_TESTS_FORCE_KNOWN_BUGS' ) ) 42 if ( ! defined( 'WP_TESTS_FORCE_KNOWN_BUGS' ) ) { 42 43 define( 'WP_TESTS_FORCE_KNOWN_BUGS', false ); 44 } 43 45 44 46 // Cron tries to make an HTTP request to the blog, which always fails, because tests are run in CLI mode only … … 54 56 // Should we run in multisite mode? 55 57 $multisite = '1' == getenv( 'WP_MULTISITE' ); 56 $multisite = $multisite || ( defined( 'WP_TESTS_MULTISITE' ) && WP_TESTS_MULTISITE );58 $multisite = $multisite || ( defined( 'WP_TESTS_MULTISITE' ) && WP_TESTS_MULTISITE ); 57 59 $multisite = $multisite || ( defined( 'MULTISITE' ) && MULTISITE ); 58 60 … … 72 74 73 75 if ( $multisite ) { 74 echo "Running as multisite...". PHP_EOL;76 echo 'Running as multisite...' . PHP_EOL; 75 77 defined( 'MULTISITE' ) or define( 'MULTISITE', true ); 76 78 defined( 'SUBDOMAIN_INSTALL' ) or define( 'SUBDOMAIN_INSTALL', false ); 77 79 $GLOBALS['base'] = '/'; 78 80 } else { 79 echo "Running as single site... To run multisite, use -c tests/phpunit/multisite.xml". PHP_EOL;81 echo 'Running as single site... To run multisite, use -c tests/phpunit/multisite.xml' . PHP_EOL; 80 82 } 81 83 unset( $multisite ); … … 87 89 // Preset WordPress options defined in bootstrap file. 88 90 // Used to activate themes, plugins, as well as other settings. 89 if (isset($GLOBALS['wp_tests_options'])) {91 if ( isset( $GLOBALS['wp_tests_options'] ) ) { 90 92 function wp_tests_options( $value ) { 91 93 $key = substr( current_filter(), strlen( 'pre_option_' ) ); 92 return $GLOBALS['wp_tests_options'][ $key];94 return $GLOBALS['wp_tests_options'][ $key ]; 93 95 } 94 96 95 97 foreach ( array_keys( $GLOBALS['wp_tests_options'] ) as $key ) { 96 tests_add_filter( 'pre_option_' .$key, 'wp_tests_options' );98 tests_add_filter( 'pre_option_' . $key, 'wp_tests_options' ); 97 99 } 98 100 } … … 143 145 PHPUnit_Util_Getopt::parseLongOption( substr( $arg, 2 ), $this->longOptions, $options, $argv ); 144 146 } 145 } 146 catch ( PHPUnit_Framework_Exception $e ) { 147 } catch ( PHPUnit_Framework_Exception $e ) { 147 148 // Enforcing recognized arguments or correctly formed arguments is 148 149 // not really the concern here. … … 152 153 153 154 $skipped_groups = array( 154 'ajax' => true,155 'ms-files' => true,155 'ajax' => true, 156 'ms-files' => true, 156 157 'external-http' => true, 157 158 ); … … 159 160 foreach ( $options as $option ) { 160 161 switch ( $option[0] ) { 161 case '--exclude-group' 162 case '--exclude-group': 162 163 foreach ( $skipped_groups as $group_name => $skipped ) { 163 164 $skipped_groups[ $group_name ] = false; 164 165 } 165 166 continue 2; 166 case '--group' 167 case '--group': 167 168 $groups = explode( ',', $option[1] ); 168 169 foreach ( $groups as $group ) { … … 192 193 echo PHP_EOL; 193 194 } 194 195 } 195 196 } 196 197 new WP_PHPUnit_Util_Getopt( $_SERVER['argv'] );
Note: See TracChangeset
for help on using the changeset viewer.