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

    r51984 r52010  
    55 */
    66class Tests_Formatting_SanitizeTitleWithDashes extends WP_UnitTestCase {
    7     function test_strips_html() {
     7    public function test_strips_html() {
    88        $input    = 'Captain <strong>Awesome</strong>';
    99        $expected = 'captain-awesome';
     
    1111    }
    1212
    13     function test_strips_unencoded_percent_signs() {
     13    public function test_strips_unencoded_percent_signs() {
    1414        $this->assertSame( 'fran%c3%a7ois', sanitize_title_with_dashes( 'fran%c3%a7%ois' ) );
    1515    }
    1616
    17     function test_makes_title_lowercase() {
     17    public function test_makes_title_lowercase() {
    1818        $this->assertSame( 'abc', sanitize_title_with_dashes( 'ABC' ) );
    1919    }
    2020
    21     function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
     21    public function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
    2222        $this->assertSame( 'a-t', sanitize_title_with_dashes( 'a          t' ) );
    2323        $this->assertSame( 'a-t', sanitize_title_with_dashes( "a    \n\n\nt" ) );
    2424    }
    2525
    26     function test_replaces_any_number_of_hyphens_with_one_hyphen() {
     26    public function test_replaces_any_number_of_hyphens_with_one_hyphen() {
    2727        $this->assertSame( 'a-t-t', sanitize_title_with_dashes( 'a----t----t' ) );
    2828    }
    2929
    30     function test_trims_trailing_hyphens() {
     30    public function test_trims_trailing_hyphens() {
    3131        $this->assertSame( 'a-t-t', sanitize_title_with_dashes( 'a----t----t----' ) );
    3232    }
    3333
    34     function test_handles_non_entity_ampersands() {
     34    public function test_handles_non_entity_ampersands() {
    3535        $this->assertSame( 'penn-teller-bull', sanitize_title_with_dashes( 'penn & teller bull' ) );
    3636    }
     
    6060    }
    6161
    62     function test_replaces_nbsp() {
     62    public function test_replaces_nbsp() {
    6363        $this->assertSame( 'dont-break-the-space', sanitize_title_with_dashes( "don't break the space", '', 'save' ) );
    6464    }
     
    6767     * @ticket 31790
    6868     */
    69     function test_replaces_nbsp_entities() {
     69    public function test_replaces_nbsp_entities() {
    7070        $this->assertSame( 'dont-break-the-space', sanitize_title_with_dashes( "don't&nbsp;break&#160;the&nbsp;space", '', 'save' ) );
    7171    }
    7272
    73     function test_replaces_ndash_mdash() {
     73    public function test_replaces_ndash_mdash() {
    7474        $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do – the Dash', '', 'save' ) );
    7575        $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do the — Dash', '', 'save' ) );
     
    7979     * @ticket 31790
    8080     */
    81     function test_replaces_ndash_mdash_entities() {
     81    public function test_replaces_ndash_mdash_entities() {
    8282        $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do &ndash; the &#8211; Dash', '', 'save' ) );
    8383        $this->assertSame( 'do-the-dash', sanitize_title_with_dashes( 'Do &mdash; the &#8212; Dash', '', 'save' ) );
    8484    }
    8585
    86     function test_replaces_iexcel_iquest() {
     86    public function test_replaces_iexcel_iquest() {
    8787        $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just ¡a Slug', '', 'save' ) );
    8888        $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just a Slug¿', '', 'save' ) );
    8989    }
    9090
    91     function test_replaces_angle_quotes() {
     91    public function test_replaces_angle_quotes() {
    9292        $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( '‹Just a Slug›', '', 'save' ) );
    9393        $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( '«Just a Slug»', '', 'save' ) );
    9494    }
    9595
    96     function test_replaces_curly_quotes() {
     96    public function test_replaces_curly_quotes() {
    9797        $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its “Curly Joe”', '', 'save' ) );
    9898        $this->assertSame( 'hey-its-curly-joe', sanitize_title_with_dashes( 'Hey its ‘Curly Joe’', '', 'save' ) );
     
    105105     * @ticket 49791
    106106     */
    107     function test_replaces_bullet() {
     107    public function test_replaces_bullet() {
    108108        $this->assertSame( 'fancy-title-amazing', sanitize_title_with_dashes( 'Fancy Title • Amazing', '', 'save' ) );
    109109    }
    110110
    111     function test_replaces_copy_reg_deg_trade() {
     111    public function test_replaces_copy_reg_deg_trade() {
    112112        $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just © a Slug', '', 'save' ) );
    113113        $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( '® Just a Slug', '', 'save' ) );
     
    119119     * @ticket 10792
    120120     */
    121     function test_replaces_forward_slash() {
     121    public function test_replaces_forward_slash() {
    122122        $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon/McCartney', '', 'save' ) );
    123123        $this->assertSame( 'songs-by-lennon-mccartney', sanitize_title_with_dashes( 'songs by Lennon//McCartney', '', 'save' ) );
     
    130130     * @ticket 19820
    131131     */
    132     function test_replaces_multiply_sign() {
     132    public function test_replaces_multiply_sign() {
    133133        $this->assertSame( '6x7-is-42', sanitize_title_with_dashes( '6×7 is 42', '', 'save' ) );
    134134    }
     
    137137     * @ticket 20772
    138138     */
    139     function test_replaces_standalone_diacritic() {
     139    public function test_replaces_standalone_diacritic() {
    140140        $this->assertSame( 'aaaa', sanitize_title_with_dashes( 'āáǎà', '', 'save' ) );
    141141    }
     
    144144     * @ticket 22395
    145145     */
    146     function test_replaces_acute_accents() {
     146    public function test_replaces_acute_accents() {
    147147        $this->assertSame( 'aaaa', sanitize_title_with_dashes( 'ááa´aˊ', '', 'save' ) );
    148148    }
Note: See TracChangeset for help on using the changeset viewer.