Make WordPress Core


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

    r51623 r52010  
    55 */
    66class Tests_Formatting_wpSpecialchars extends WP_UnitTestCase {
    7     function test_wp_specialchars_basics() {
     7    public function test_wp_specialchars_basics() {
    88        $html = '&<hello world>';
    99        $this->assertSame( $html, _wp_specialchars( $html ) );
     
    1313    }
    1414
    15     function test_allowed_entity_names() {
     15    public function test_allowed_entity_names() {
    1616        global $allowedentitynames;
    1717
     
    2727    }
    2828
    29     function test_not_allowed_entity_names() {
     29    public function test_not_allowed_entity_names() {
    3030        $ents = array( 'iacut', 'aposs', 'pos', 'apo', 'apo?', 'apo.*', '.*apo.*', 'apos ', ' apos', ' apos ' );
    3131
     
    3737    }
    3838
    39     function test_optionally_escapes_quotes() {
     39    public function test_optionally_escapes_quotes() {
    4040        $source = "\"'hello!'\"";
    4141        $this->assertSame( '"'hello!'"', _wp_specialchars( $source, 'single' ) );
     
    5151     * @dataProvider data_double_encoding
    5252     */
    53     function test_double_encoding( $input, $output ) {
     53    public function test_double_encoding( $input, $output ) {
    5454        return $this->assertSame( $output, _wp_specialchars( $input, ENT_NOQUOTES, false, true ) );
    5555    }
    5656
    57     function data_double_encoding() {
     57    public function data_double_encoding() {
    5858        return array(
    5959            array(
     
    7878     * @dataProvider data_no_double_encoding
    7979     */
    80     function test_no_double_encoding( $input, $output ) {
     80    public function test_no_double_encoding( $input, $output ) {
    8181        return $this->assertSame( $output, _wp_specialchars( $input, ENT_NOQUOTES, false, false ) );
    8282    }
    8383
    84     function data_no_double_encoding() {
     84    public function data_no_double_encoding() {
    8585        return array(
    8686            array(
Note: See TracChangeset for help on using the changeset viewer.