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

    r51623 r52010  
    1515    private $long_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius lacinia vehicula. Etiam sapien risus, ultricies ac posuere eu, convallis sit amet augue. Pellentesque urna massa, lacinia vel iaculis eget, bibendum in mauris. Aenean eleifend pulvinar ligula, a convallis eros gravida non. Suspendisse potenti. Pellentesque et odio tortor. In vulputate pellentesque libero, sed dapibus velit mollis viverra. Pellentesque id urna euismod dolor cursus sagittis.';
    1616
    17     function test_trims_to_55_by_default() {
     17    public function test_trims_to_55_by_default() {
    1818        $trimmed = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius lacinia vehicula. Etiam sapien risus, ultricies ac posuere eu, convallis sit amet augue. Pellentesque urna massa, lacinia vel iaculis eget, bibendum in mauris. Aenean eleifend pulvinar ligula, a convallis eros gravida non. Suspendisse potenti. Pellentesque et odio tortor. In vulputate pellentesque libero, sed dapibus velit…';
    1919        $this->assertSame( $trimmed, wp_trim_words( $this->long_text ) );
    2020    }
    2121
    22     function test_trims_to_10() {
     22    public function test_trims_to_10() {
    2323        $trimmed = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius…';
    2424        $this->assertSame( $trimmed, wp_trim_words( $this->long_text, 10 ) );
    2525    }
    2626
    27     function test_trims_to_5_and_uses_custom_more() {
     27    public function test_trims_to_5_and_uses_custom_more() {
    2828        $trimmed = 'Lorem ipsum dolor sit amet,[...] Read on!';
    2929        $this->assertSame( $trimmed, wp_trim_words( $this->long_text, 5, '[...] Read on!' ) );
    3030    }
    3131
    32     function test_strips_tags_before_trimming() {
     32    public function test_strips_tags_before_trimming() {
    3333        $text    = 'This text contains a <a href="http://wordpress.org"> link </a> to WordPress.org!';
    3434        $trimmed = 'This text contains a link&hellip;';
     
    3939     * @ticket 18726
    4040     */
    41     function test_strips_script_and_style_content() {
     41    public function test_strips_script_and_style_content() {
    4242        $trimmed = 'This text contains. It should go.';
    4343
     
    4949    }
    5050
    51     function test_doesnt_trim_short_text() {
     51    public function test_doesnt_trim_short_text() {
    5252        $text = 'This is some short text.';
    5353        $this->assertSame( $text, wp_trim_words( $text ) );
     
    5757     * @ticket 44541
    5858     */
    59     function test_trims_to_20_counted_by_chars() {
     59    public function test_trims_to_20_counted_by_chars() {
    6060        switch_to_locale( 'ja_JP' );
    6161        $expected = substr( $this->long_text, 0, 20 ) . '&hellip;';
     
    6868     * @ticket 44541
    6969     */
    70     function test_trims_to_20_counted_by_chars_with_double_width_chars() {
     70    public function test_trims_to_20_counted_by_chars_with_double_width_chars() {
    7171        switch_to_locale( 'ja_JP' );
    7272        $text     = str_repeat( 'あ', 100 );
     
    8080     * @ticket 47867
    8181     */
    82     function test_works_with_non_numeric_num_words() {
     82    public function test_works_with_non_numeric_num_words() {
    8383        $this->assertSame( '', wp_trim_words( $this->long_text, '', '' ) );
    8484        $this->assertSame( '', wp_trim_words( $this->long_text, 'abc', '' ) );
Note: See TracChangeset for help on using the changeset viewer.