Make WordPress Core


Ignore:
Timestamp:
10/25/2016 10:24:57 AM (8 years ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/functions.php

    r38858 r38907  
    162162    return $uploads;
    163163}
    164 
    165 /**
    166  * Helper functions to link and unlink the empty default theme into the WordPress install
    167  */
    168 function _symlink_default_theme() {
    169     _unlink_default_theme();
    170     symlink( DIR_TESTDATA . '/themedir1/default', ABSPATH . '/wp-content/themes/default' );
    171 }
    172 
    173 function _unlink_default_theme() {
    174     if ( file_exists( ABSPATH . '/wp-content/themes/default' ) ) {
    175         unlink( ABSPATH . '/wp-content/themes/default' );
    176     }
    177 }
    178 // Only unlink when we're in the main process.
    179 if ( 'phpunit' === substr( $GLOBALS['argv'][0], -7 ) ) {
    180     register_shutdown_function( '_unlink_default_theme' );
    181 }
Note: See TracChangeset for help on using the changeset viewer.