Make WordPress Core

Changeset 51287


Ignore:
Timestamp:
06/30/2021 06:21:52 PM (4 years ago)
Author:
SergeyBiryukov
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].

See #52627.

Location:
trunk/tests/phpunit/tests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-sidebars-controller.php

    r51235 r51287  
    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
  • trunk/tests/phpunit/tests/theme/wpTheme.php

    r50967 r51287  
    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
  • trunk/tests/phpunit/tests/theme/wpThemeJson.php

    r51281 r51287  
    1717     * @ticket 52991
    1818     */
    19     function test_get_settings() {
     19    public function test_get_settings() {
    2020        $theme_json = new WP_Theme_JSON(
    2121            array(
     
    6868     * @ticket 53397
    6969     */
    70     function test_get_settings_presets_are_keyed_by_origin() {
     70    public function test_get_settings_presets_are_keyed_by_origin() {
    7171        $core_origin = new WP_Theme_JSON(
    7272            array(
     
    196196     * @ticket 53175
    197197     */
    198     function test_get_stylesheet() {
     198    public function test_get_stylesheet() {
    199199        $theme_json = new WP_Theme_JSON(
    200200            array(
     
    317317     * @ticket 52991
    318318     */
    319     function test_get_stylesheet_preset_classes_work_with_compounded_selectors() {
     319    public function test_get_stylesheet_preset_classes_work_with_compounded_selectors() {
    320320        $theme_json = new WP_Theme_JSON(
    321321            array(
     
    347347     * @ticket 53175
    348348     */
    349     function test_get_stylesheet_preset_rules_come_after_block_rules() {
     349    public function test_get_stylesheet_preset_rules_come_after_block_rules() {
    350350        $theme_json = new WP_Theme_JSON(
    351351            array(
     
    671671     * @ticket 52991
    672672     */
    673     function test_get_from_editor_settings() {
     673    public function test_get_from_editor_settings() {
    674674        $input = array(
    675675            'disableCustomColors'    => true,
     
    747747     * @ticket 52991
    748748     */
    749     function test_get_editor_settings_no_theme_support() {
     749    public function test_get_editor_settings_no_theme_support() {
    750750        $input = array(
    751751            '__unstableEnableFullSiteEditingBlocks' => false,
     
    802802     * @ticket 52991
    803803     */
    804     function test_get_editor_settings_blank() {
     804    public function test_get_editor_settings_blank() {
    805805        $expected = array(
    806806            'version'  => WP_Theme_JSON::LATEST_SCHEMA,
     
    815815     * @ticket 52991
    816816     */
    817     function test_get_editor_settings_custom_units_can_be_disabled() {
     817    public function test_get_editor_settings_custom_units_can_be_disabled() {
    818818        add_theme_support( 'custom-units', array() );
    819819        $input = get_default_block_editor_settings();
     
    832832     * @ticket 52991
    833833     */
    834     function test_get_editor_settings_custom_units_can_be_enabled() {
     834    public function test_get_editor_settings_custom_units_can_be_enabled() {
    835835        add_theme_support( 'custom-units' );
    836836        $input = get_default_block_editor_settings();
     
    849849     * @ticket 52991
    850850     */
    851     function test_get_editor_settings_custom_units_can_be_filtered() {
     851    public function test_get_editor_settings_custom_units_can_be_filtered() {
    852852        add_theme_support( 'custom-units', 'rem', 'em' );
    853853        $input = get_default_block_editor_settings();
  • trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php

    r51196 r51287  
    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.