WordPress.org

Make WordPress Core

Changeset 30298


Ignore:
Timestamp:
11/10/2014 02:48:28 PM (7 years ago)
Author:
boonebgorges
Message:

Exclude external-http tests when running phpunit.

The external-http tests are very slow, and Wp_Http functionality is fairly
isolated, so the benefits of skipping these tests by default outweigh the
risks.

A grunt phpunit:external-http subtask has been added, to ensure that the
tests are executed during exhaustive runs of the test suite, such as in
continuous integration.

Fixes #30304.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Gruntfile.js

    r30069 r30298  
    329329                cmd: 'phpunit',
    330330                args: ['-c', 'tests/phpunit/multisite.xml']
     331            },
     332            'external-http': {
     333                cmd: 'phpunit',
     334                args: ['-c', 'phpunit.xml.dist', '--group', 'external-http']
    331335            }
    332336        },
     
    483487
    484488    // Testing tasks.
    485     grunt.registerMultiTask('phpunit', 'Runs PHPUnit tests, including the ajax and multisite tests.', function() {
     489    grunt.registerMultiTask('phpunit', 'Runs PHPUnit tests, including the ajax, external-http, and multisite tests.', function() {
    486490        grunt.util.spawn({
    487491            cmd: this.data.cmd,
  • trunk/phpunit.xml.dist

    r29869 r30298  
    2121        <exclude>
    2222            <group>ajax</group>
     23            <group>external-http</group>
    2324        </exclude>
    2425    </groups>
  • trunk/tests/phpunit/includes/bootstrap.php

    r30286 r30298  
    129129        }
    130130
    131         $ajax_message = true;
    132         $ms_files_message = true;
     131        $skipped_groups = array(
     132            'ajax' => true,
     133            'ms-files' => true,
     134            'external-http' => true,
     135        );
     136
    133137        foreach ( $options as $option ) {
    134138            switch ( $option[0] ) {
    135139                case '--exclude-group' :
    136                     $ajax_message = false;
    137                     $ms_files_message = false;
     140                    foreach ( $skipped_groups as $group_name => $skipped ) {
     141                        $skipped_groups[ $group_name ] = false;
     142                    }
    138143                    continue 2;
    139144                case '--group' :
     
    144149                        }
    145150                    }
    146                     $ajax_message = ! in_array( 'ajax', $groups );
    147                     $ms_files_message = ! in_array( 'ms-files', $groups );
     151
     152                    foreach ( $skipped_groups as $group_name => $skipped ) {
     153                        if ( in_array( $group_name, $groups ) ) {
     154                            $skipped_groups[ $group_name ] = false;
     155                        }
     156                    }
    148157                    continue 2;
    149158            }
    150159        }
    151         if ( $ajax_message ) {
    152             echo "Not running ajax tests... To execute these, use --group ajax." . PHP_EOL;
    153         }
    154         if ( $ms_files_message ) {
    155             echo "Not running ms_files_rewriting tests... To execute these, use --group ms-files." . PHP_EOL;
     160
     161        $skipped_groups = array_filter( $skipped_groups );
     162        foreach ( $skipped_groups as $group_name => $skipped ) {
     163            echo sprintf( 'Not running %1$s tests. To execute these, use --group %1$s.', $group_name ) . PHP_EOL;
    156164        }
    157165    }
Note: See TracChangeset for help on using the changeset viewer.