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

    r51623 r52010  
    55 */
    66class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
    7     function test_mailto_xss() {
     7    public function test_mailto_xss() {
    88        $in = 'testzzz@"STYLE="behavior:url(\'#default#time2\')"onBegin="alert(\'refresh-XSS\')"';
    99        $this->assertSame( $in, make_clickable( $in ) );
    1010    }
    1111
    12     function test_valid_mailto() {
     12    public function test_valid_mailto() {
    1313        $valid_emails = array(
    1414            'foo@example.com',
     
    2323    }
    2424
    25     function test_invalid_mailto() {
     25    public function test_invalid_mailto() {
    2626        $invalid_emails = array(
    2727            'foo',
     
    4141     * and (semi-)colons in URLs with protocol (i.e. http://wordpress.org).
    4242     */
    43     function test_strip_trailing_with_protocol() {
     43    public function test_strip_trailing_with_protocol() {
    4444        $urls_before   = array(
    4545            'http://wordpress.org/hello.html',
     
    6868     * and (semi-)colons in URLs with protocol (i.e. http://wordpress.org).
    6969     */
    70     function test_strip_trailing_with_protocol_nothing_afterwards() {
     70    public function test_strip_trailing_with_protocol_nothing_afterwards() {
    7171        $urls_before   = array(
    7272            'http://wordpress.org/hello.html',
     
    9797     * and (semi-)colons in URLs without protocol (i.e. www.wordpress.org).
    9898     */
    99     function test_strip_trailing_without_protocol() {
     99    public function test_strip_trailing_without_protocol() {
    100100        $urls_before   = array(
    101101            'www.wordpress.org',
     
    124124     * and (semi-)colons in URLs without protocol (i.e. www.wordpress.org).
    125125     */
    126     function test_strip_trailing_without_protocol_nothing_afterwards() {
     126    public function test_strip_trailing_without_protocol_nothing_afterwards() {
    127127        $urls_before   = array(
    128128            'www.wordpress.org',
     
    150150     * @ticket 4570
    151151     */
    152     function test_iri() {
     152    public function test_iri() {
    153153        $urls_before   = array(
    154154            'http://www.詹姆斯.com/',
     
    169169     * @ticket 10990
    170170     */
    171     function test_brackets_in_urls() {
     171    public function test_brackets_in_urls() {
    172172        $urls_before   = array(
    173173            'http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)',
     
    208208     * @ticket 11211
    209209     */
    210     function test_real_world_examples() {
     210    public function test_real_world_examples() {
    211211        $urls_before   = array(
    212212            'Example: WordPress, test (some text), I love example.com (http://example.org), it is brilliant',
     
    229229     * @ticket 14993
    230230     */
    231     function test_twitter_hash_bang() {
     231    public function test_twitter_hash_bang() {
    232232        $urls_before   = array(
    233233            'http://twitter.com/#!/wordpress/status/25907440233',
     
    245245    }
    246246
    247     function test_wrapped_in_angles() {
     247    public function test_wrapped_in_angles() {
    248248        $before   = array(
    249249            'URL wrapped in angle brackets <http://example.com/>',
     
    261261    }
    262262
    263     function test_preceded_by_punctuation() {
     263    public function test_preceded_by_punctuation() {
    264264        $before   = array(
    265265            'Comma then URL,http://example.com/',
     
    283283    }
    284284
    285     function test_dont_break_attributes() {
     285    public function test_dont_break_attributes() {
    286286        $urls_before   = array(
    287287            "<img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'>",
     
    310310     * @ticket 23756
    311311     */
    312     function test_no_links_inside_pre_or_code() {
     312    public function test_no_links_inside_pre_or_code() {
    313313        $before = array(
    314314            '<pre>http://wordpress.org</pre>',
     
    351351     * @ticket 16892
    352352     */
    353     function test_click_inside_html() {
     353    public function test_click_inside_html() {
    354354        $urls_before   = array(
    355355            '<span>http://example.com</span>',
     
    365365    }
    366366
    367     function test_no_links_within_links() {
     367    public function test_no_links_within_links() {
    368368        $in = array(
    369369            'Some text with a link <a href="http://example.com">http://example.com</a>',
     
    378378     * @ticket 16892
    379379     */
    380     function test_no_segfault() {
     380    public function test_no_segfault() {
    381381        $in  = str_repeat( 'http://example.com/2011/03/18/post-title/', 256 );
    382382        $out = make_clickable( $in );
     
    387387     * @ticket 19028
    388388     */
    389     function test_line_break_in_existing_clickable_link() {
     389    public function test_line_break_in_existing_clickable_link() {
    390390        $html = "<a
    391391                  href='mailto:someone@example.com'>someone@example.com</a>";
Note: See TracChangeset for help on using the changeset viewer.