Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/bootstrap.php

    r42228 r42343  
    1414if ( ! file_exists( $config_file_path . '/wp-tests-config.php' ) ) {
    1515    // 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' ) {
    1717        $config_file_path = dirname( dirname( $config_file_path ) );
     18    }
    1819}
    1920$config_file_path .= '/wp-tests-config.php';
     
    3940define( 'WP_LANG_DIR', DIR_TESTDATA . '/languages' );
    4041
    41 if ( ! defined( 'WP_TESTS_FORCE_KNOWN_BUGS' ) )
     42if ( ! defined( 'WP_TESTS_FORCE_KNOWN_BUGS' ) ) {
    4243    define( 'WP_TESTS_FORCE_KNOWN_BUGS', false );
     44}
    4345
    4446// Cron tries to make an HTTP request to the blog, which always fails, because tests are run in CLI mode only
     
    5456// Should we run in multisite mode?
    5557$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 );
    5759$multisite = $multisite || ( defined( 'MULTISITE' ) && MULTISITE );
    5860
     
    7274
    7375if ( $multisite ) {
    74     echo "Running as multisite..." . PHP_EOL;
     76    echo 'Running as multisite...' . PHP_EOL;
    7577    defined( 'MULTISITE' ) or define( 'MULTISITE', true );
    7678    defined( 'SUBDOMAIN_INSTALL' ) or define( 'SUBDOMAIN_INSTALL', false );
    7779    $GLOBALS['base'] = '/';
    7880} 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;
    8082}
    8183unset( $multisite );
     
    8789// Preset WordPress options defined in bootstrap file.
    8890// Used to activate themes, plugins, as well as  other settings.
    89 if(isset($GLOBALS['wp_tests_options'])) {
     91if ( isset( $GLOBALS['wp_tests_options'] ) ) {
    9092    function wp_tests_options( $value ) {
    9193        $key = substr( current_filter(), strlen( 'pre_option_' ) );
    92         return $GLOBALS['wp_tests_options'][$key];
     94        return $GLOBALS['wp_tests_options'][ $key ];
    9395    }
    9496
    9597    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' );
    9799    }
    98100}
     
    143145                    PHPUnit_Util_Getopt::parseLongOption( substr( $arg, 2 ), $this->longOptions, $options, $argv );
    144146                }
    145             }
    146             catch ( PHPUnit_Framework_Exception $e ) {
     147            } catch ( PHPUnit_Framework_Exception $e ) {
    147148                // Enforcing recognized arguments or correctly formed arguments is
    148149                // not really the concern here.
     
    152153
    153154        $skipped_groups = array(
    154             'ajax' => true,
    155             'ms-files' => true,
     155            'ajax'          => true,
     156            'ms-files'      => true,
    156157            'external-http' => true,
    157158        );
     
    159160        foreach ( $options as $option ) {
    160161            switch ( $option[0] ) {
    161                 case '--exclude-group' :
     162                case '--exclude-group':
    162163                    foreach ( $skipped_groups as $group_name => $skipped ) {
    163164                        $skipped_groups[ $group_name ] = false;
    164165                    }
    165166                    continue 2;
    166                 case '--group' :
     167                case '--group':
    167168                    $groups = explode( ',', $option[1] );
    168169                    foreach ( $groups as $group ) {
     
    192193            echo PHP_EOL;
    193194        }
    194     }
     195    }
    195196}
    196197new WP_PHPUnit_Util_Getopt( $_SERVER['argv'] );
Note: See TracChangeset for help on using the changeset viewer.