WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/21/2016 11:02:37 AM (4 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/data/themedir1/default/functions.php

    r25002 r38858  
    11<?php
    22
    3 // dummy theme
     3// Minimum functions.php to pass unit tests
    44
    5 echo dirname(__FILE__).'/'.basename(__FILE__);
     5function default_widgets_init() {
     6    register_sidebar( array( 'id' => 'sidebar-1' ) );
     7}
     8add_action( 'widgets_init', 'default_widgets_init' );
    69
    7 ?>
     10function default_after_setup_theme() {
     11    add_theme_support( 'post-thumbnails' );
     12
     13    // Don't call it after wp_loaded has happened, for tests that manually re-run load actions.
     14    if( ! did_action( 'wp_loaded' ) ) {
     15        add_theme_support( 'title-tag' );
     16    }
     17}
     18add_action( 'after_setup_theme', 'default_after_setup_theme' );
Note: See TracChangeset for help on using the changeset viewer.