Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (3 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/formatting/removeAccents.php

    r51623 r52010  
    8181    }
    8282
    83     function _remove_accents_germanic_umlauts_cb() {
     83    public function remove_accents_germanic_umlauts_cb() {
    8484        return 'de_DE';
    8585    }
     
    8989     */
    9090    public function test_remove_accents_germanic_umlauts() {
    91         add_filter( 'locale', array( $this, '_remove_accents_germanic_umlauts_cb' ) );
     91        add_filter( 'locale', array( $this, 'remove_accents_germanic_umlauts_cb' ) );
    9292
    9393        $this->assertSame( 'AeOeUeaeoeuess', remove_accents( 'ÄÖÜäöüß' ) );
    9494
    95         remove_filter( 'locale', array( $this, '_remove_accents_germanic_umlauts_cb' ) );
     95        remove_filter( 'locale', array( $this, 'remove_accents_germanic_umlauts_cb' ) );
    9696    }
    9797
    98     public function _set_locale_to_danish() {
     98    public function set_locale_to_danish() {
    9999        return 'da_DK';
    100100    }
     
    104104     */
    105105    public function test_remove_danish_accents() {
    106         add_filter( 'locale', array( $this, '_set_locale_to_danish' ) );
     106        add_filter( 'locale', array( $this, 'set_locale_to_danish' ) );
    107107
    108108        $this->assertSame( 'AeOeAaaeoeaa', remove_accents( 'ÆØÅæøå' ) );
    109109
    110         remove_filter( 'locale', array( $this, '_set_locale_to_danish' ) );
     110        remove_filter( 'locale', array( $this, 'set_locale_to_danish' ) );
    111111    }
    112112
    113     public function _set_locale_to_catalan() {
     113    public function set_locale_to_catalan() {
    114114        return 'ca';
    115115    }
     
    119119     */
    120120    public function test_remove_catalan_middot() {
    121         add_filter( 'locale', array( $this, '_set_locale_to_catalan' ) );
     121        add_filter( 'locale', array( $this, 'set_locale_to_catalan' ) );
    122122
    123123        $this->assertSame( 'allallalla', remove_accents( 'al·lallaŀla' ) );
    124124
    125         remove_filter( 'locale', array( $this, '_set_locale_to_catalan' ) );
     125        remove_filter( 'locale', array( $this, 'set_locale_to_catalan' ) );
    126126
    127127        $this->assertSame( 'al·lallalla', remove_accents( 'al·lallaŀla' ) );
    128128    }
    129129
    130     public function _set_locale_to_serbian() {
     130    public function set_locale_to_serbian() {
    131131        return 'sr_RS';
    132132    }
     
    136136     */
    137137    public function test_transcribe_serbian_crossed_d() {
    138         add_filter( 'locale', array( $this, '_set_locale_to_serbian' ) );
     138        add_filter( 'locale', array( $this, 'set_locale_to_serbian' ) );
    139139
    140140        $this->assertSame( 'DJdj', remove_accents( 'Đđ' ) );
    141141
    142         remove_filter( 'locale', array( $this, '_set_locale_to_serbian' ) );
     142        remove_filter( 'locale', array( $this, 'set_locale_to_serbian' ) );
    143143
    144144        $this->assertSame( 'Dd', remove_accents( 'Đđ' ) );
Note: See TracChangeset for help on using the changeset viewer.