mirror of
git://develop.git.wordpress.org/
synced 2025-01-16 20:38:35 +01:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@30298 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4b1aa89206
commit
df11fb8593
@ -328,6 +328,10 @@ module.exports = function(grunt) {
|
||||
multisite: {
|
||||
cmd: 'phpunit',
|
||||
args: ['-c', 'tests/phpunit/multisite.xml']
|
||||
},
|
||||
'external-http': {
|
||||
cmd: 'phpunit',
|
||||
args: ['-c', 'phpunit.xml.dist', '--group', 'external-http']
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
@ -482,7 +486,7 @@ module.exports = function(grunt) {
|
||||
'uglify:core', 'uglify:jqueryui', 'concat:tinymce', 'compress:tinymce', 'clean:tinymce', 'jsvalidate:build']);
|
||||
|
||||
// Testing tasks.
|
||||
grunt.registerMultiTask('phpunit', 'Runs PHPUnit tests, including the ajax and multisite tests.', function() {
|
||||
grunt.registerMultiTask('phpunit', 'Runs PHPUnit tests, including the ajax, external-http, and multisite tests.', function() {
|
||||
grunt.util.spawn({
|
||||
cmd: this.data.cmd,
|
||||
args: this.data.args,
|
||||
|
@ -20,6 +20,7 @@
|
||||
<groups>
|
||||
<exclude>
|
||||
<group>ajax</group>
|
||||
<group>external-http</group>
|
||||
</exclude>
|
||||
</groups>
|
||||
<logging>
|
||||
|
@ -128,13 +128,18 @@ class WP_PHPUnit_Util_Getopt extends PHPUnit_Util_Getopt {
|
||||
}
|
||||
}
|
||||
|
||||
$ajax_message = true;
|
||||
$ms_files_message = true;
|
||||
$skipped_groups = array(
|
||||
'ajax' => true,
|
||||
'ms-files' => true,
|
||||
'external-http' => true,
|
||||
);
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
switch ( $option[0] ) {
|
||||
case '--exclude-group' :
|
||||
$ajax_message = false;
|
||||
$ms_files_message = false;
|
||||
foreach ( $skipped_groups as $group_name => $skipped ) {
|
||||
$skipped_groups[ $group_name ] = false;
|
||||
}
|
||||
continue 2;
|
||||
case '--group' :
|
||||
$groups = explode( ',', $option[1] );
|
||||
@ -143,16 +148,19 @@ class WP_PHPUnit_Util_Getopt extends PHPUnit_Util_Getopt {
|
||||
WP_UnitTestCase::forceTicket( $group );
|
||||
}
|
||||
}
|
||||
$ajax_message = ! in_array( 'ajax', $groups );
|
||||
$ms_files_message = ! in_array( 'ms-files', $groups );
|
||||
|
||||
foreach ( $skipped_groups as $group_name => $skipped ) {
|
||||
if ( in_array( $group_name, $groups ) ) {
|
||||
$skipped_groups[ $group_name ] = false;
|
||||
}
|
||||
}
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
if ( $ajax_message ) {
|
||||
echo "Not running ajax tests... To execute these, use --group ajax." . PHP_EOL;
|
||||
}
|
||||
if ( $ms_files_message ) {
|
||||
echo "Not running ms_files_rewriting tests... To execute these, use --group ms-files." . PHP_EOL;
|
||||
|
||||
$skipped_groups = array_filter( $skipped_groups );
|
||||
foreach ( $skipped_groups as $group_name => $skipped ) {
|
||||
echo sprintf( 'Not running %1$s tests. To execute these, use --group %1$s.', $group_name ) . PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user