mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-25 15:54:26 +00:00
Tests: Use a minimal theme for tests.
This functionality was originally added in [38858], using `symlink()` to put a link to the theme in WordPress' `themes` directory. Unfortunately, not all installs have write access to the `themes` directory, causing unit tests to fail. The new method is to add the test theme directory to `$wp_theme_directories`, and fix the handful of tests that don't expect `$wp_theme_directories` to have multiple entries. The test install/bootstrap routines now also check that `WP_DEFAULT_THEME` is defined, in case the tests are being run on a system that hasn't upgraded its' `wp-tests-config.php`. See #31550. Fixes #38457. git-svn-id: https://develop.svn.wordpress.org/trunk@38907 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -16,7 +16,7 @@ $config_file_path .= '/wp-tests-config.php';
|
||||
* Globalize some WordPress variables, because PHPUnit loads this file inside a function
|
||||
* See: https://github.com/sebastianbergmann/phpunit/issues/325
|
||||
*/
|
||||
global $wpdb, $current_site, $current_blog, $wp_rewrite, $shortcode_tags, $wp, $phpmailer;
|
||||
global $wpdb, $current_site, $current_blog, $wp_rewrite, $shortcode_tags, $wp, $phpmailer, $wp_theme_directories;
|
||||
|
||||
if ( !is_readable( $config_file_path ) ) {
|
||||
die( "ERROR: wp-tests-config.php is missing! Please use wp-tests-config-sample.php to create a config file.\n" );
|
||||
@@ -53,8 +53,11 @@ $multisite = $multisite || ( defined( 'MULTISITE' ) && MULTISITE );
|
||||
require_once( dirname( __FILE__ ) . '/mock-mailer.php' );
|
||||
$phpmailer = new MockPHPMailer();
|
||||
|
||||
// Add a symlink to the empty default theme to the themes directory, so it can be used for the tests.
|
||||
_symlink_default_theme();
|
||||
// Set the theme to our special empty theme, to avoid interference from the current Twenty* theme.
|
||||
if ( ! defined( 'WP_DEFAULT_THEME' ) ) {
|
||||
define( 'WP_DEFAULT_THEME', 'default' );
|
||||
}
|
||||
$wp_theme_directories = array( DIR_TESTDATA . '/themedir1' );
|
||||
|
||||
system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( $config_file_path ) . ' ' . $multisite );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user