WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (2 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

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

    r46586 r47122  
    1414        add_filter( 'stylesheet_root', array( $this, '_theme_root' ) );
    1515        add_filter( 'template_root', array( $this, '_theme_root' ) );
    16         // clear caches
     16        // Clear caches.
    1717        wp_clean_themes_cache();
    1818        unset( $GLOBALS['wp_themes'] );
     
    2929    }
    3030
    31     // replace the normal theme root dir with our premade test dir
     31    // Replace the normal theme root directory with our premade test directory.
    3232    function _theme_root( $dir ) {
    3333        return $this->theme_root;
     
    3636        $theme = new WP_Theme( 'theme1', $this->theme_root );
    3737
    38         //Meta
     38        // Meta.
    3939        $this->assertEquals( 'My Theme', $theme->get( 'Name' ) );
    4040        $this->assertEquals( 'http://example.org/', $theme->get( 'ThemeURI' ) );
     
    4747        $this->assertEquals( array(), $theme->get( 'Tags' ) );
    4848
    49         //Important
     49        // Important.
    5050        $this->assertEquals( 'theme1', $theme->get_stylesheet() );
    5151        $this->assertEquals( 'theme1', $theme->get_template() );
     
    5555        $theme = new WP_Theme( 'subdir/theme2', $this->theme_root );
    5656
    57         //Meta
     57        // Meta.
    5858        $this->assertEquals( 'My Subdir Theme', $theme->get( 'Name' ) );
    5959        $this->assertEquals( 'http://example.org/', $theme->get( 'ThemeURI' ) );
     
    6666        $this->assertEquals( array(), $theme->get( 'Tags' ) );
    6767
    68         //Important
     68        // Important.
    6969        $this->assertEquals( 'subdir/theme2', $theme->get_stylesheet() );
    7070        $this->assertEquals( 'subdir/theme2', $theme->get_template() );
     
    7575     */
    7676    function test_new_WP_Theme_subdir_bad_root() {
    77         // This is what get_theme_data() does when you pass it a style.css file for a theme in a subdir.
     77        // This is what get_theme_data() does when you pass it a style.css file for a theme in a subdirectory.
    7878        $theme = new WP_Theme( 'theme2', $this->theme_root . '/subdir' );
    7979
    80         //Meta
     80        // Meta.
    8181        $this->assertEquals( 'My Subdir Theme', $theme->get( 'Name' ) );
    8282        $this->assertEquals( 'http://example.org/', $theme->get( 'ThemeURI' ) );
     
    8989        $this->assertEquals( array(), $theme->get( 'Tags' ) );
    9090
    91         //Important
     91        // Important.
    9292        $this->assertEquals( 'subdir/theme2', $theme->get_stylesheet() );
    9393        $this->assertEquals( 'subdir/theme2', $theme->get_template() );
     
    102102        $this->assertEquals( 'subdir/theme with spaces', $theme->get_stylesheet() );
    103103
    104         // Check that in a URI path, we have raw url encoding (spaces become %20)
     104        // Check that in a URI path, we have raw URL encoding (spaces become %20).
    105105        // Don't try to verify the complete URI path. get_theme_root_uri() breaks down quickly.
    106106        $this->assertEquals( 'theme%20with%20spaces', basename( $theme->get_stylesheet_directory_uri() ) );
    107107        $this->assertEquals( 'theme%20with%20spaces', basename( $theme->get_template_directory_uri() ) );
    108108
    109         // Check that wp_customize_url() uses url encoding, as it is a query arg (spaces become +)
     109        // Check that wp_customize_url() uses URL encoding, as it is a query arg (spaces become +).
    110110        $this->assertEquals( admin_url( 'customize.php?theme=theme+with+spaces' ), wp_customize_url( 'theme with spaces' ) );
    111111    }
     
    163163        WP_Theme::network_enable_theme( $theme );
    164164        $new_allowed_themes = get_site_option( 'allowedthemes' );
    165         update_site_option( 'allowedthemes', $current_allowed_themes ); // reset previous value.
     165        update_site_option( 'allowedthemes', $current_allowed_themes ); // Reset previous value.
    166166        $current_allowed_themes['testtheme-1'] = true; // Add the new theme to the previous set.
    167167
     
    180180        WP_Theme::network_enable_theme( $themes );
    181181        $new_allowed_themes = get_site_option( 'allowedthemes' );
    182         update_site_option( 'allowedthemes', $current_allowed_themes ); // reset previous value.
     182        update_site_option( 'allowedthemes', $current_allowed_themes ); // Reset previous value.
    183183        $current_allowed_themes = array_merge(
    184184            $current_allowed_themes,
     
    211211        WP_Theme::network_disable_theme( $disable_theme );
    212212        $new_allowed_themes = get_site_option( 'allowedthemes' );
    213         update_site_option( 'allowedthemes', $current_allowed_themes ); // reset previous value.
     213        update_site_option( 'allowedthemes', $current_allowed_themes ); // Reset previous value.
    214214        unset( $allowed_themes[ $disable_theme ] ); // Remove deleted theme from initial set.
    215215
     
    236236        WP_Theme::network_disable_theme( $disable_themes );
    237237        $new_allowed_themes = get_site_option( 'allowedthemes' );
    238         update_site_option( 'allowedthemes', $current_allowed_themes ); // reset previous value.
     238        update_site_option( 'allowedthemes', $current_allowed_themes ); // Reset previous value.
    239239        unset( $allowed_themes['existing-4'] );
    240240        unset( $allowed_themes['existing-5'] );
Note: See TracChangeset for help on using the changeset viewer.