mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Build/Test Tools: Fix message display in test bootstrap.
Any messages to the user which are echo-ed out in the test bootstrap will generally display on a command-line interface. The *nix specific `"\n"` line ending will be ignored on Windows, making the messages less readable. For new lines in CLI messages, `PHP_EOL` should be used instead. This was already done in a few places in the script, but not consistently so. Fixed now. Follow-up to [UT882], [UT890], [44723], [45020], [48592], [49535], [51560]. Props jrf. See #53363. git-svn-id: https://develop.svn.wordpress.org/trunk@51581 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
fa2c313224
commit
53f5eaddb4
@ -23,7 +23,7 @@ if ( defined( 'WP_TESTS_CONFIG_FILE_PATH' ) ) {
|
||||
global $wpdb, $current_site, $current_blog, $wp_rewrite, $shortcode_tags, $wp, $phpmailer, $wp_theme_directories;
|
||||
|
||||
if ( ! is_readable( $config_file_path ) ) {
|
||||
echo "Error: wp-tests-config.php is missing! Please use wp-tests-config-sample.php to create a config file.\n";
|
||||
echo 'Error: wp-tests-config.php is missing! Please use wp-tests-config-sample.php to create a config file.' . PHP_EOL;
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ require_once $config_file_path;
|
||||
require_once __DIR__ . '/functions.php';
|
||||
|
||||
if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS && ! is_dir( ABSPATH ) ) {
|
||||
echo "Error: The /build/ directory is missing! Please run `npm run build` prior to running PHPUnit.\n";
|
||||
echo 'Error: The /build/ directory is missing! Please run `npm run build` prior to running PHPUnit.' . PHP_EOL;
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
@ -39,18 +39,18 @@ $phpunit_version = tests_get_phpunit_version();
|
||||
|
||||
if ( version_compare( $phpunit_version, '5.7.21', '<' ) ) {
|
||||
printf(
|
||||
"Error: Looks like you're using PHPUnit %s. WordPress requires at least PHPUnit 5.7.21.\n",
|
||||
'Error: Looks like you’re using PHPUnit %s. WordPress requires at least PHPUnit 5.7.21.' . PHP_EOL,
|
||||
$phpunit_version
|
||||
);
|
||||
echo "Please use the latest PHPUnit version supported for the PHP version you are running the tests on.\n";
|
||||
echo 'Please use the latest PHPUnit version supported for the PHP version you are running the tests on.' . PHP_EOL;
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
// Check that the PHPUnit Polyfills autoloader exists.
|
||||
$phpunit_polyfills_autoloader = __DIR__ . '/../../../vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';
|
||||
if ( ! file_exists( $phpunit_polyfills_autoloader ) ) {
|
||||
echo "Error: You need to run `composer update` before running the tests.\n";
|
||||
echo "You can still use a PHPUnit phar to run them, but the dependencies do need to be installed.\n";
|
||||
echo 'Error: You need to run `composer update` before running the tests.' . PHP_EOL;
|
||||
echo 'You can still use a PHPUnit phar to run them, but the dependencies do need to be installed.' . PHP_EOL;
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
@ -69,10 +69,10 @@ if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) {
|
||||
|
||||
if ( $missing_extensions ) {
|
||||
printf(
|
||||
"Error: The following required PHP extensions are missing from the testing environment: %s.\n",
|
||||
'Error: The following required PHP extensions are missing from the testing environment: %s.' . PHP_EOL,
|
||||
implode( ', ', $missing_extensions )
|
||||
);
|
||||
echo "Please make sure they are installed and enabled.\n",
|
||||
echo 'Please make sure they are installed and enabled.' . PHP_EOL,
|
||||
exit( 1 );
|
||||
}
|
||||
}
|
||||
@ -93,10 +93,10 @@ foreach ( $required_constants as $constant ) {
|
||||
|
||||
if ( $missing_constants ) {
|
||||
printf(
|
||||
"Error: The following required constants are not defined: %s.\n",
|
||||
'Error: The following required constants are not defined: %s.' . PHP_EOL,
|
||||
implode( ', ', $missing_constants )
|
||||
);
|
||||
echo "Please check out `wp-tests-config-sample.php` for an example.\n",
|
||||
echo 'Please check out `wp-tests-config-sample.php` for an example.' . PHP_EOL,
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user