Tests: Use a minimal theme for tests.

New default themes require workarounds being added to several unit tests, as they often alter default WordPress behaviour. To avoid ongoing maintenance issues, this change switches to a minimal theme when running tests.

This change also removes the old workarounds for default themes.

Fixes #31550.



git-svn-id: https://develop.svn.wordpress.org/trunk@38858 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2016-10-21 11:02:37 +00:00
parent e7d639345f
commit 9d7e8fec8c
17 changed files with 48 additions and 59 deletions

View File

@@ -161,3 +161,21 @@ 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' );
}