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/term/getTermBy.php

    r51462 r52010  
    66class Tests_Term_GetTermBy extends WP_UnitTestCase {
    77
    8     function test_get_term_by_slug() {
     8    public function test_get_term_by_slug() {
    99        $term1 = wp_insert_term( 'Foo', 'category', array( 'slug' => 'foo' ) );
    1010        $term2 = get_term_by( 'slug', 'foo', 'category' );
     
    1212    }
    1313
    14     function test_get_term_by_name() {
     14    public function test_get_term_by_name() {
    1515        $term1 = wp_insert_term( 'Foo', 'category', array( 'slug' => 'foo' ) );
    1616        $term2 = get_term_by( 'name', 'Foo', 'category' );
     
    1818    }
    1919
    20     function test_get_term_by_id() {
     20    public function test_get_term_by_id() {
    2121        $term1 = wp_insert_term( 'Foo', 'category', array( 'slug' => 'foo' ) );
    2222        $term2 = get_term_by( 'id', $term1['term_id'], 'category' );
     
    2727     * 'term_id' is an alias of 'id'.
    2828     */
    29     function test_get_term_by_term_id() {
     29    public function test_get_term_by_term_id() {
    3030        $term1 = wp_insert_term( 'Foo', 'category', array( 'slug' => 'foo' ) );
    3131        $term2 = get_term_by( 'term_id', $term1['term_id'], 'category' );
     
    3636     * @ticket 45163
    3737     */
    38     function test_get_term_by_uppercase_id() {
     38    public function test_get_term_by_uppercase_id() {
    3939        $term1 = wp_insert_term( 'Foo', 'category', array( 'slug' => 'foo' ) );
    4040        $term2 = get_term_by( 'ID', $term1['term_id'], 'category' );
     
    4545     * @ticket 21651
    4646     */
    47     function test_get_term_by_tt_id() {
     47    public function test_get_term_by_tt_id() {
    4848        $term1 = wp_insert_term( 'Foo', 'category' );
    4949        $term2 = get_term_by( 'term_taxonomy_id', $term1['term_taxonomy_id'], 'category' );
     
    5151    }
    5252
    53     function test_get_term_by_unknown() {
     53    public function test_get_term_by_unknown() {
    5454        wp_insert_term( 'Foo', 'category', array( 'slug' => 'foo' ) );
    5555        $term2 = get_term_by( 'unknown', 'foo', 'category' );
     
    6060     * @ticket 33281
    6161     */
    62     function test_get_term_by_with_nonexistent_id_should_return_false() {
     62    public function test_get_term_by_with_nonexistent_id_should_return_false() {
    6363        $term = get_term_by( 'id', 123456, 'category' );
    6464        $this->assertFalse( $term );
Note: See TracChangeset for help on using the changeset viewer.