Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (2 years ago)
Author:
hellofromTonya
Message:

Coding Standards: Add visibility to methods in tests/phpunit/tests/.

Adds a public visibility to test fixtures, tests, data providers, and callbacks methods.

Adds a private visibility to helper methods within test classes.

Renames callbacks and helpers that previously started with a _ prefix. Why? For consistency and to leverage using the method visibility. Further naming standardizations is beyond the scope of this commit.

Props costdev, jrf, hellofromTonya.
Fixes #54177.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme/themeDir.php

    r51568 r52010  
    88class Tests_Theme_ThemeDir extends WP_UnitTestCase {
    99
    10     function set_up() {
     10    public function set_up() {
    1111        parent::set_up();
    1212        $this->theme_root = DIR_TESTDATA . '/themedir1';
     
    1717        $GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this->theme_root );
    1818
    19         add_filter( 'theme_root', array( $this, '_theme_root' ) );
    20         add_filter( 'stylesheet_root', array( $this, '_theme_root' ) );
    21         add_filter( 'template_root', array( $this, '_theme_root' ) );
     19        add_filter( 'theme_root', array( $this, 'filter_theme_root' ) );
     20        add_filter( 'stylesheet_root', array( $this, 'filter_theme_root' ) );
     21        add_filter( 'template_root', array( $this, 'filter_theme_root' ) );
    2222        // Clear caches.
    2323        wp_clean_themes_cache();
     
    2525    }
    2626
    27     function tear_down() {
     27    public function tear_down() {
    2828        $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
    2929        wp_clean_themes_cache();
     
    3333
    3434    // Replace the normal theme root directory with our premade test directory.
    35     function _theme_root( $dir ) {
     35    public function filter_theme_root( $dir ) {
    3636        return $this->theme_root;
    3737    }
     
    4141     * @expectedDeprecated get_themes
    4242     */
    43     function test_theme_default() {
     43    public function test_theme_default() {
    4444        $themes = get_themes();
    4545        $theme  = get_theme( 'WordPress Default' );
     
    7272     * @expectedDeprecated get_themes
    7373     */
    74     function test_theme_sandbox() {
     74    public function test_theme_sandbox() {
    7575        $theme = get_theme( 'Sandbox' );
    7676
     
    108108     * @expectedDeprecated get_themes
    109109     */
    110     function test_theme_stylesheet_only() {
     110    public function test_theme_stylesheet_only() {
    111111        $themes = get_themes();
    112112
     
    138138     * @expectedDeprecated get_themes
    139139     */
    140     function test_theme_list() {
     140    public function test_theme_list() {
    141141        $themes = get_themes();
    142142
     
    175175     * @expectedDeprecated get_broken_themes
    176176     */
    177     function test_broken_themes() {
     177    public function test_broken_themes() {
    178178        $themes = get_themes();
    179179
     
    194194    }
    195195
    196     function test_wp_get_theme_with_non_default_theme_root() {
     196    public function test_wp_get_theme_with_non_default_theme_root() {
    197197        $this->assertFalse( wp_get_theme( 'sandbox', $this->theme_root )->errors() );
    198198        $this->assertFalse( wp_get_theme( 'sandbox' )->errors() );
     
    202202     * @expectedDeprecated get_themes
    203203     */
    204     function test_page_templates() {
     204    public function test_page_templates() {
    205205        $themes = get_themes();
    206206
     
    215215     * @expectedDeprecated get_theme_data
    216216     */
    217     function test_get_theme_data_top_level() {
     217    public function test_get_theme_data_top_level() {
    218218        $theme_data = get_theme_data( DIR_TESTDATA . '/themedir1/theme1/style.css' );
    219219
     
    234234     * @expectedDeprecated get_theme_data
    235235     */
    236     function test_get_theme_data_subdir() {
     236    public function test_get_theme_data_subdir() {
    237237        $theme_data = get_theme_data( $this->theme_root . '/subdir/theme2/style.css' );
    238238
     
    253253     * @ticket 28662
    254254     */
    255     function test_theme_dir_slashes() {
     255    public function test_theme_dir_slashes() {
    256256        $size = count( $GLOBALS['wp_theme_directories'] );
    257257
Note: See TracChangeset for help on using the changeset viewer.