mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00: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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user