I18N: Revert [49236] for now to investigate alternative implementations.

See #39210, #51678, #26511.

git-svn-id: https://develop.svn.wordpress.org/trunk@49566 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling
2020-11-12 14:41:19 +00:00
parent e8e031d2dd
commit 4006c07417
30 changed files with 134 additions and 605 deletions

View File

@@ -37,11 +37,6 @@ if ( ! is_readable( $config_file_path ) ) {
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";
exit( 1 );
}
$phpunit_version = tests_get_phpunit_version();
if ( version_compare( $phpunit_version, '5.4', '<' ) || version_compare( $phpunit_version, '8.0', '>=' ) ) {
@@ -53,23 +48,8 @@ if ( version_compare( $phpunit_version, '5.4', '<' ) || version_compare( $phpuni
exit( 1 );
}
$required_extensions = array(
'gd',
);
$missing_extensions = array();
foreach ( $required_extensions as $extension ) {
if ( ! extension_loaded( $extension ) ) {
$missing_extensions[] = $extension;
}
}
if ( $missing_extensions ) {
printf(
"Error: The following required PHP extensions are missing from the testing environment: %s.\n",
implode( ', ', $missing_extensions )
);
echo "Please make sure they are installed and enabled.\n",
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";
exit( 1 );
}
@@ -79,34 +59,24 @@ $required_constants = array(
'WP_TESTS_TITLE',
'WP_PHP_BINARY',
);
$missing_constants = array();
foreach ( $required_constants as $constant ) {
if ( ! defined( $constant ) ) {
$missing_constants[] = $constant;
printf(
"Error: The required %s constant is not defined. Check out `wp-tests-config-sample.php` for an example.\n",
$constant
);
exit( 1 );
}
}
if ( $missing_constants ) {
printf(
"Error: The following required constants are not defined: %s.\n",
implode( ', ', $missing_constants )
);
echo "Please check out `wp-tests-config-sample.php` for an example.\n",
exit( 1 );
}
tests_reset__SERVER();
define( 'WP_TESTS_TABLE_PREFIX', $table_prefix );
define( 'DIR_TESTDATA', __DIR__ . '/../data' );
define( 'DIR_TESTROOT', realpath( dirname( __DIR__ ) ) );
define( 'WP_LANG_DIR', realpath( DIR_TESTDATA . '/languages' ) );
if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) {
define( 'WP_PLUGIN_DIR', realpath( DIR_TESTDATA . '/plugins' ) );
}
define( 'WP_LANG_DIR', DIR_TESTDATA . '/languages' );
if ( ! defined( 'WP_TESTS_FORCE_KNOWN_BUGS' ) ) {
define( 'WP_TESTS_FORCE_KNOWN_BUGS', false );
@@ -170,10 +140,6 @@ $GLOBALS['_wp_die_disabled'] = false;
tests_add_filter( 'wp_die_handler', '_wp_die_handler_filter' );
// Use the Spy REST Server instead of default.
tests_add_filter( 'wp_rest_server_class', '_wp_rest_server_class_filter' );
// Prevent updating translations asynchronously.
tests_add_filter( 'async_update_translation', '__return_false' );
// Disable background updates.
tests_add_filter( 'automatic_updater_disabled', '__return_true' );
// Preset WordPress options defined in bootstrap file.
// Used to activate themes, plugins, as well as other settings.