Make WordPress Core


Ignore:
Timestamp:
10/21/2016 11:02:37 AM (8 years ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

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

    r38582 r38858  
    162162    return $uploads;
    163163}
     164
     165/**
     166 * Helper functions to link and unlink the empty default theme into the WordPress install
     167 */
     168function _symlink_default_theme() {
     169    _unlink_default_theme();
     170    symlink( DIR_TESTDATA . '/themedir1/default', ABSPATH . '/wp-content/themes/default' );
     171}
     172
     173function _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.
     179if ( 'phpunit' === substr( $GLOBALS['argv'][0], -7 ) ) {
     180    register_shutdown_function( '_unlink_default_theme' );
     181}
Note: See TracChangeset for help on using the changeset viewer.