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/query/search.php

    r51568 r52010  
    88    protected $post_type;
    99
    10     function set_up() {
     10    public function set_up() {
    1111        parent::set_up();
    1212
     
    1717    }
    1818
    19     function tear_down() {
     19    public function tear_down() {
    2020        unset( $this->q );
    2121
     
    2323    }
    2424
    25     function get_search_results( $terms ) {
     25    private function get_search_results( $terms ) {
    2626        $args = http_build_query(
    2727            array(
     
    3333    }
    3434
    35     function test_search_order_title_relevance() {
     35    public function test_search_order_title_relevance() {
    3636        foreach ( range( 1, 7 ) as $i ) {
    3737            self::factory()->post->create(
     
    5353    }
    5454
    55     function test_search_terms_query_var() {
     55    public function test_search_terms_query_var() {
    5656        $terms = 'This is a search term';
    5757        $query = new WP_Query( array( 's' => 'This is a search term' ) );
     
    6060    }
    6161
    62     function test_filter_stopwords() {
     62    public function test_filter_stopwords() {
    6363        $terms = 'This is a search term';
    6464        add_filter( 'wp_search_stopwords', array( $this, 'filter_wp_search_stopwords' ) );
     
    7070    }
    7171
    72     function filter_wp_search_stopwords() {
     72    public function filter_wp_search_stopwords() {
    7373        return array();
    7474    }
     
    7777     * @ticket 38099
    7878     */
    79     function test_disable_search_exclusion_prefix() {
     79    public function test_disable_search_exclusion_prefix() {
    8080        $title = '-HYPHENATION_TEST';
    8181
     
    102102     * @ticket 38099
    103103     */
    104     function test_change_search_exclusion_prefix() {
     104    public function test_change_search_exclusion_prefix() {
    105105        $title = '#OCTOTHORPE_TEST';
    106106
     
    125125    }
    126126
    127     function filter_search_exclusion_prefix_octothorpe() {
     127    public function filter_search_exclusion_prefix_octothorpe() {
    128128        return '#';
    129129    }
Note: See TracChangeset for help on using the changeset viewer.