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/l10n/loadTextdomain.php

    r51568 r52010  
    110110     * @ticket 21319
    111111     */
    112     function test_is_textdomain_is_not_loaded_after_gettext_call_with_no_translations() {
     112    public function test_is_textdomain_is_not_loaded_after_gettext_call_with_no_translations() {
    113113        $this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
    114114        __( 'just some string', 'wp-tests-domain' );
     
    116116    }
    117117
    118     function test_override_load_textdomain_noop() {
     118    public function test_override_load_textdomain_noop() {
    119119        add_filter( 'override_load_textdomain', '__return_true' );
    120120        $load_textdomain = load_textdomain( 'wp-tests-domain', DIR_TESTDATA . '/non-existent-file' );
     
    125125    }
    126126
    127     function test_override_load_textdomain_non_existent_mofile() {
    128         add_filter( 'override_load_textdomain', array( $this, '_override_load_textdomain_filter' ), 10, 3 );
     127    public function test_override_load_textdomain_non_existent_mofile() {
     128        add_filter( 'override_load_textdomain', array( $this, 'override_load_textdomain_filter' ), 10, 3 );
    129129        $load_textdomain = load_textdomain( 'wp-tests-domain', WP_LANG_DIR . '/non-existent-file.mo' );
    130         remove_filter( 'override_load_textdomain', array( $this, '_override_load_textdomain_filter' ) );
     130        remove_filter( 'override_load_textdomain', array( $this, 'override_load_textdomain_filter' ) );
    131131
    132132        $is_textdomain_loaded = is_textdomain_loaded( 'wp-tests-domain' );
     
    139139    }
    140140
    141     function test_override_load_textdomain_custom_mofile() {
    142         add_filter( 'override_load_textdomain', array( $this, '_override_load_textdomain_filter' ), 10, 3 );
     141    public function test_override_load_textdomain_custom_mofile() {
     142        add_filter( 'override_load_textdomain', array( $this, 'override_load_textdomain_filter' ), 10, 3 );
    143143        $load_textdomain = load_textdomain( 'wp-tests-domain', WP_LANG_DIR . '/plugins/internationalized-plugin-de_DE.mo' );
    144         remove_filter( 'override_load_textdomain', array( $this, '_override_load_textdomain_filter' ) );
     144        remove_filter( 'override_load_textdomain', array( $this, 'override_load_textdomain_filter' ) );
    145145
    146146        $is_textdomain_loaded = is_textdomain_loaded( 'wp-tests-domain' );
     
    159159     * @return bool
    160160     */
    161     function _override_load_textdomain_filter( $override, $domain, $file ) {
     161    public function override_load_textdomain_filter( $override, $domain, $file ) {
    162162        global $l10n;
    163163
Note: See TracChangeset for help on using the changeset viewer.