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

    r51623 r52010  
    55 */
    66class Tests_Formatting_EscJs extends WP_UnitTestCase {
    7     function test_js_escape_simple() {
     7    public function test_js_escape_simple() {
    88        $out = esc_js( 'foo bar baz();' );
    99        $this->assertSame( 'foo bar baz();', $out );
    1010    }
    1111
    12     function test_js_escape_quotes() {
     12    public function test_js_escape_quotes() {
    1313        $out = esc_js( 'foo "bar" \'baz\'' );
    1414        // Does it make any sense to change " into "?  Why not \"?
     
    1616    }
    1717
    18     function test_js_escape_backslash() {
     18    public function test_js_escape_backslash() {
    1919        $bs  = '\\';
    2020        $out = esc_js( 'foo ' . $bs . 't bar ' . $bs . $bs . ' baz' );
     
    2323    }
    2424
    25     function test_js_escape_amp() {
     25    public function test_js_escape_amp() {
    2626        $out = esc_js( 'foo & bar &baz;  ' );
    2727        $this->assertSame( 'foo & bar &baz;  ', $out );
    2828    }
    2929
    30     function test_js_escape_quote_entity() {
     30    public function test_js_escape_quote_entity() {
    3131        $out = esc_js( 'foo ' bar ' baz &' );
    3232        $this->assertSame( "foo \\' bar \\' baz &", $out );
    3333    }
    3434
    35     function test_js_no_carriage_return() {
     35    public function test_js_no_carriage_return() {
    3636        $out = esc_js( "foo\rbar\nbaz\r" );
    3737        // \r is stripped.
     
    3939    }
    4040
    41     function test_js_escape_rn() {
     41    public function test_js_escape_rn() {
    4242        $out = esc_js( "foo\r\nbar\nbaz\r\n" );
    4343        // \r is stripped.
Note: See TracChangeset for help on using the changeset viewer.