Make WordPress Core

Changeset 51305


Ignore:
Timestamp:
07/02/2021 12:24:08 PM (3 years ago)
Author:
desrosj
Message:

Coding Standards: Add missing visibility keywords to WP_Theme, WP_Theme_JSON, and WP_Theme_JSON_Resolver tests.

Follow-up to [50959], [50960], [50967].

Props SergeyBiryukov.
Merges [51287] to the 5.8 branch.
Fixes #52627.

Location:
branches/5.8
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/tests/phpunit/tests/rest-api/rest-sidebars-controller.php

    r51235 r51305  
    6363    }
    6464
    65     function clean_up_global_scope() {
     65    public function clean_up_global_scope() {
    6666        global $wp_widget_factory, $wp_registered_sidebars, $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates;
    6767
  • branches/5.8/tests/phpunit/tests/theme/wpTheme.php

    r50967 r51305  
    1010 */
    1111class Tests_Theme_wpTheme extends WP_UnitTestCase {
    12     function setUp() {
     12
     13    public function setUp() {
    1314        parent::setUp();
    1415        $this->theme_root = realpath( DIR_TESTDATA . '/themedir1' );
     
    2526    }
    2627
    27     function tearDown() {
     28    public function tearDown() {
    2829        $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
    2930        wp_clean_themes_cache();
     
    3334
    3435    // Replace the normal theme root directory with our premade test directory.
    35     function _theme_root( $dir ) {
     36    public function _theme_root( $dir ) {
    3637        return $this->theme_root;
    3738    }
    38     function test_new_WP_Theme_top_level() {
     39
     40    public function test_new_WP_Theme_top_level() {
    3941        $theme = new WP_Theme( 'theme1', $this->theme_root );
    4042
     
    5557    }
    5658
    57     function test_new_WP_Theme_subdir() {
     59    public function test_new_WP_Theme_subdir() {
    5860        $theme = new WP_Theme( 'subdir/theme2', $this->theme_root );
    5961
     
    7779     * @ticket 20313
    7880     */
    79     function test_new_WP_Theme_subdir_bad_root() {
     81    public function test_new_WP_Theme_subdir_bad_root() {
    8082        // This is what get_theme_data() does when you pass it a style.css file for a theme in a subdirectory.
    8183        $theme = new WP_Theme( 'theme2', $this->theme_root . '/subdir' );
     
    100102     * @ticket 21749
    101103     */
    102     function test_wp_theme_uris_with_spaces() {
     104    public function test_wp_theme_uris_with_spaces() {
    103105        $theme = new WP_Theme( 'theme with spaces', $this->theme_root . '/subdir' );
    104106        // Make sure subdir/ is considered part of the stylesheet, as we must avoid encoding /'s.
     
    117119     * @ticket 21969
    118120     */
    119     function test_theme_uris_with_spaces() {
     121    public function test_theme_uris_with_spaces() {
    120122        $callback = array( $this, 'filter_theme_with_spaces' );
    121123        add_filter( 'stylesheet', $callback );
     
    129131    }
    130132
    131     function filter_theme_with_spaces() {
     133    public function filter_theme_with_spaces() {
    132134        return 'subdir/theme with spaces';
    133135    }
     
    136138     * @ticket 26873
    137139     */
    138     function test_display_method_on_get_method_failure() {
     140    public function test_display_method_on_get_method_failure() {
    139141        $theme = new WP_Theme( 'nonexistent', $this->theme_root );
    140142        $this->assertSame( 'nonexistent', $theme->get( 'Name' ) );
     
    147149     * @ticket 40820
    148150     */
    149     function test_child_theme_with_itself_as_parent_should_appear_as_broken() {
     151    public function test_child_theme_with_itself_as_parent_should_appear_as_broken() {
    150152        $theme  = new WP_Theme( 'child-parent-itself', $this->theme_root );
    151153        $errors = $theme->errors();
     
    161163     * @group ms-required
    162164     */
    163     function test_wp_theme_network_enable_single_theme() {
     165    public function test_wp_theme_network_enable_single_theme() {
    164166        $theme                  = 'testtheme-1';
    165167        $current_allowed_themes = get_site_option( 'allowedthemes' );
     
    178180     * @group ms-required
    179181     */
    180     function test_wp_theme_network_enable_multiple_themes() {
     182    public function test_wp_theme_network_enable_multiple_themes() {
    181183        $themes                 = array( 'testtheme-2', 'testtheme-3' );
    182184        $current_allowed_themes = get_site_option( 'allowedthemes' );
     
    201203     * @group ms-required
    202204     */
    203     function test_network_disable_single_theme() {
     205    public function test_network_disable_single_theme() {
    204206        $current_allowed_themes = get_site_option( 'allowedthemes' );
    205207
     
    226228     * @group ms-required
    227229     */
    228     function test_network_disable_multiple_themes() {
     230    public function test_network_disable_multiple_themes() {
    229231        $current_allowed_themes = get_site_option( 'allowedthemes' );
    230232
  • branches/5.8/tests/phpunit/tests/theme/wpThemeJson.php

    r51198 r51305  
    1717     * @ticket 52991
    1818     */
    19     function test_get_settings() {
     19    public function test_get_settings() {
    2020        $theme_json = new WP_Theme_JSON(
    2121            array(
     
    6565    }
    6666
    67     function test_get_settings_presets_are_keyed_by_origin() {
     67    public function test_get_settings_presets_are_keyed_by_origin() {
    6868        $core_origin = new WP_Theme_JSON(
    6969            array(
     
    190190    }
    191191
    192     function test_get_stylesheet() {
     192    public function test_get_stylesheet() {
    193193        $theme_json = new WP_Theme_JSON(
    194194            array(
     
    308308    }
    309309
    310     function test_get_stylesheet_preset_classes_work_with_compounded_selectors() {
     310    public function test_get_stylesheet_preset_classes_work_with_compounded_selectors() {
    311311        $theme_json = new WP_Theme_JSON(
    312312            array(
     
    335335    }
    336336
    337     function test_get_stylesheet_preset_rules_come_after_block_rules() {
     337    public function test_get_stylesheet_preset_rules_come_after_block_rules() {
    338338        $theme_json = new WP_Theme_JSON(
    339339            array(
     
    656656     * @ticket 52991
    657657     */
    658     function test_get_from_editor_settings() {
     658    public function test_get_from_editor_settings() {
    659659        $input = array(
    660660            'disableCustomColors'    => true,
     
    732732     * @ticket 52991
    733733     */
    734     function test_get_editor_settings_no_theme_support() {
     734    public function test_get_editor_settings_no_theme_support() {
    735735        $input = array(
    736736            '__unstableEnableFullSiteEditingBlocks' => false,
     
    787787     * @ticket 52991
    788788     */
    789     function test_get_editor_settings_blank() {
     789    public function test_get_editor_settings_blank() {
    790790        $expected = array(
    791791            'version'  => WP_Theme_JSON::LATEST_SCHEMA,
     
    800800     * @ticket 52991
    801801     */
    802     function test_get_editor_settings_custom_units_can_be_disabled() {
     802    public function test_get_editor_settings_custom_units_can_be_disabled() {
    803803        add_theme_support( 'custom-units', array() );
    804804        $input = get_default_block_editor_settings();
     
    817817     * @ticket 52991
    818818     */
    819     function test_get_editor_settings_custom_units_can_be_enabled() {
     819    public function test_get_editor_settings_custom_units_can_be_enabled() {
    820820        add_theme_support( 'custom-units' );
    821821        $input = get_default_block_editor_settings();
     
    834834     * @ticket 52991
    835835     */
    836     function test_get_editor_settings_custom_units_can_be_filtered() {
     836    public function test_get_editor_settings_custom_units_can_be_filtered() {
    837837        add_theme_support( 'custom-units', 'rem', 'em' );
    838838        $input = get_default_block_editor_settings();
  • branches/5.8/tests/phpunit/tests/theme/wpThemeJsonResolver.php

    r51196 r51305  
    1313class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase {
    1414
    15     function setUp() {
     15    public function setUp() {
    1616        parent::setUp();
    1717        $this->theme_root = realpath( DIR_TESTDATA . '/themedir1' );
     
    3030    }
    3131
    32     function tearDown() {
     32    public function tearDown() {
    3333        $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
    3434        wp_clean_themes_cache();
     
    3737    }
    3838
    39     function filter_set_theme_root() {
     39    public function filter_set_theme_root() {
    4040        return $this->theme_root;
    4141    }
    4242
    43     function filter_set_locale_to_polish() {
     43    public function filter_set_locale_to_polish() {
    4444        return 'pl_PL';
    4545    }
     
    4848     * @ticket 52991
    4949     */
    50     function test_fields_are_extracted() {
     50    public function test_fields_are_extracted() {
    5151        $actual = WP_Theme_JSON_Resolver::get_fields_to_translate();
    5252
     
    9595     * @ticket 52991
    9696     */
    97     function test_translations_are_applied() {
     97    public function test_translations_are_applied() {
    9898        add_filter( 'locale', array( $this, 'filter_set_locale_to_polish' ) );
    9999        load_textdomain( 'fse', realpath( DIR_TESTDATA . '/languages/themes/fse-pl_PL.mo' ) );
     
    149149     * @ticket 52991
    150150     */
    151     function test_switching_themes_recalculates_data() {
     151    public function test_switching_themes_recalculates_data() {
    152152        // By default, the theme for unit tests is "default",
    153153        // which doesn't have theme.json support.
Note: See TracChangeset for help on using the changeset viewer.