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:
Gary Pendergast
2016-10-25 10:24:57 +00:00
parent 4e8410a886
commit ee65fc1f80
4 changed files with 23 additions and 21 deletions

View File

@@ -161,21 +161,3 @@ function _upload_dir_https( $uploads ) {
return $uploads;
}
/**
* Helper functions to link and unlink the empty default theme into the WordPress install
*/
function _symlink_default_theme() {
_unlink_default_theme();
symlink( DIR_TESTDATA . '/themedir1/default', ABSPATH . '/wp-content/themes/default' );
}
function _unlink_default_theme() {
if ( file_exists( ABSPATH . '/wp-content/themes/default' ) ) {
unlink( ABSPATH . '/wp-content/themes/default' );
}
}
// Only unlink when we're in the main process.
if ( 'phpunit' === substr( $GLOBALS['argv'][0], -7 ) ) {
register_shutdown_function( '_unlink_default_theme' );
}