Changeset 38907
- Timestamp:
- 10/25/2016 10:24:57 AM (8 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/bootstrap.php
r38858 r38907 17 17 * See: https://github.com/sebastianbergmann/phpunit/issues/325 18 18 */ 19 global $wpdb, $current_site, $current_blog, $wp_rewrite, $shortcode_tags, $wp, $phpmailer ;19 global $wpdb, $current_site, $current_blog, $wp_rewrite, $shortcode_tags, $wp, $phpmailer, $wp_theme_directories; 20 20 21 21 if ( !is_readable( $config_file_path ) ) { … … 54 54 $phpmailer = new MockPHPMailer(); 55 55 56 // Add a symlink to the empty default theme to the themes directory, so it can be used for the tests. 57 _symlink_default_theme(); 56 // Set the theme to our special empty theme, to avoid interference from the current Twenty* theme. 57 if ( ! defined( 'WP_DEFAULT_THEME' ) ) { 58 define( 'WP_DEFAULT_THEME', 'default' ); 59 } 60 $wp_theme_directories = array( DIR_TESTDATA . '/themedir1' ); 58 61 59 62 system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( $config_file_path ) . ' ' . $multisite ); -
trunk/tests/phpunit/includes/functions.php
r38858 r38907 162 162 return $uploads; 163 163 } 164 165 /**166 * Helper functions to link and unlink the empty default theme into the WordPress install167 */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 } -
trunk/tests/phpunit/includes/install.php
r38470 r38907 9 9 $config_file_path = $argv[1]; 10 10 $multisite = ! empty( $argv[2] ); 11 12 // Set the theme to our special empty theme, to avoid interference from the current Twenty* theme. 13 if ( ! defined( 'WP_DEFAULT_THEME' ) ) { 14 define( 'WP_DEFAULT_THEME', 'default' ); 15 } 16 $wp_theme_directories = array( dirname( __FILE__ ) . '/../data/themedir1' ); 11 17 12 18 define( 'WP_INSTALLING', true ); -
trunk/tests/phpunit/tests/theme.php
r38755 r38907 15 15 16 16 function setUp() { 17 global $wp_theme_directories; 18 17 19 parent::setUp(); 20 21 $backup_wp_theme_directories = $wp_theme_directories; 22 $wp_theme_directories = array( WP_CONTENT_DIR . '/themes' ); 23 18 24 add_filter( 'extra_theme_headers', array( $this, '_theme_data_extra_headers' ) ); 19 25 wp_clean_themes_cache(); … … 22 28 23 29 function tearDown() { 30 global $wp_theme_directories; 31 32 $wp_theme_directories = $this->wp_theme_directories; 33 24 34 remove_filter( 'extra_theme_headers', array( $this, '_theme_data_extra_headers' ) ); 25 35 wp_clean_themes_cache(); 26 36 unset( $GLOBALS['wp_themes'] ); 37 27 38 parent::tearDown(); 28 39 }
Note: See TracChangeset
for help on using the changeset viewer.