=' ) ) { require dirname( __FILE__ ) . '/phpunit7/testcase.php'; } else { require dirname( __FILE__ ) . '/testcase.php'; } require dirname( __FILE__ ) . '/testcase-rest-api.php'; require dirname( __FILE__ ) . '/testcase-rest-controller.php'; require dirname( __FILE__ ) . '/testcase-rest-post-type-controller.php'; require dirname( __FILE__ ) . '/testcase-xmlrpc.php'; require dirname( __FILE__ ) . '/testcase-ajax.php'; require dirname( __FILE__ ) . '/testcase-canonical.php'; require dirname( __FILE__ ) . '/exceptions.php'; require dirname( __FILE__ ) . '/utils.php'; require dirname( __FILE__ ) . '/spy-rest-server.php'; require dirname( __FILE__ ) . '/class-wp-rest-test-search-handler.php'; require dirname( __FILE__ ) . '/class-wp-fake-block-type.php'; /** * A class to handle additional command line arguments passed to the script. * * If it is determined that phpunit was called with a --group that corresponds * to an @ticket annotation (such as `phpunit --group 12345` for bugs marked * as #WP12345), then it is assumed that known bugs should not be skipped. * * If WP_TESTS_FORCE_KNOWN_BUGS is already set in wp-tests-config.php, then * how you call phpunit has no effect. */ class WP_PHPUnit_Util_Getopt { function __construct( $argv ) { $skipped_groups = array( 'ajax' => true, 'ms-files' => true, 'external-http' => true, ); while ( current( $argv ) ) { $option = current( $argv ); $value = next( $argv ); switch ( $option ) { case '--exclude-group': foreach ( $skipped_groups as $group_name => $skipped ) { $skipped_groups[ $group_name ] = false; } continue 2; case '--group': $groups = explode( ',', $value ); foreach ( $groups as $group ) { if ( is_numeric( $group ) || preg_match( '/^(UT|Plugin)\d+$/', $group ) ) { WP_UnitTestCase::forceTicket( $group ); } } foreach ( $skipped_groups as $group_name => $skipped ) { if ( in_array( $group_name, $groups ) ) { $skipped_groups[ $group_name ] = false; } } continue 2; } } $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; } if ( ! isset( $skipped_groups['external-http'] ) ) { echo PHP_EOL; echo 'External HTTP skipped tests can be caused by timeouts.' . PHP_EOL; echo 'If this changeset includes changes to HTTP, make sure there are no timeouts.' . PHP_EOL; echo PHP_EOL; } } } new WP_PHPUnit_Util_Getopt( $_SERVER['argv'] );