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/escTextarea.php

    r51623 r52010  
    66class Tests_Formatting_EscTextarea extends WP_UnitTestCase {
    77
    8     function _charset_iso_8859_1() {
     8    public function charset_iso_8859_1() {
    99        return 'iso-8859-1';
    1010    }
     
    1414     * @ticket 23688
    1515     */
    16     function test_esc_textarea_charset_iso_8859_1() {
    17         add_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
     16    public function test_esc_textarea_charset_iso_8859_1() {
     17        add_filter( 'pre_option_blog_charset', array( $this, 'charset_iso_8859_1' ) );
    1818        $iso8859_1 = 'Fran' . chr( 135 ) . 'ais';
    1919        $this->assertSame( $iso8859_1, esc_textarea( $iso8859_1 ) );
    20         remove_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
     20        remove_filter( 'pre_option_blog_charset', array( $this, 'charset_iso_8859_1' ) );
    2121    }
    2222
    23     function _charset_utf_8() {
     23    public function charset_utf_8() {
    2424        return 'UTF-8';
    2525    }
     
    2828     * @ticket 23688
    2929     */
    30     function test_esc_textarea_charset_utf_8() {
    31         add_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
     30    public function test_esc_textarea_charset_utf_8() {
     31        add_filter( 'pre_option_blog_charset', array( $this, 'charset_utf_8' ) );
    3232        $utf8 = 'Fran' . chr( 195 ) . chr( 167 ) . 'ais';
    3333        $this->assertSame( $utf8, esc_textarea( $utf8 ) );
    34         remove_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
     34        remove_filter( 'pre_option_blog_charset', array( $this, 'charset_utf_8' ) );
    3535    }
    3636}
Note: See TracChangeset for help on using the changeset viewer.