Make WordPress Core


Ignore:
Timestamp:
07/31/2022 03:03:46 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Update the terminology used for action or filter names in hook tests.

This replaces the $tag variables with $hook_name, to match the core function signatures.

Follow-up to [24/tests], [62/tests], [866/tests], [1294/tests], [38571], [50807].

See #55652.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/hooks/hasFilter.php

    r52389 r53804  
    1212        $callback      = '__return_null';
    1313        $hook          = new WP_Hook();
    14         $tag           = __FUNCTION__;
     14        $hook_name     = __FUNCTION__;
    1515        $priority      = 1;
    1616        $accepted_args = 2;
    1717
    18         $hook->add_filter( $tag, $callback, $priority, $accepted_args );
     18        $hook->add_filter( $hook_name, $callback, $priority, $accepted_args );
    1919
    20         $this->assertSame( $priority, $hook->has_filter( $tag, $callback ) );
     20        $this->assertSame( $priority, $hook->has_filter( $hook_name, $callback ) );
    2121    }
    2222
     
    2525        $callback      = array( $a, 'action' );
    2626        $hook          = new WP_Hook();
    27         $tag           = __FUNCTION__;
     27        $hook_name     = __FUNCTION__;
    2828        $priority      = 1;
    2929        $accepted_args = 2;
    3030
    31         $hook->add_filter( $tag, $callback, $priority, $accepted_args );
     31        $hook->add_filter( $hook_name, $callback, $priority, $accepted_args );
    3232
    33         $this->assertSame( $priority, $hook->has_filter( $tag, $callback ) );
     33        $this->assertSame( $priority, $hook->has_filter( $hook_name, $callback ) );
    3434    }
    3535
     
    3737        $callback      = array( 'MockAction', 'action' );
    3838        $hook          = new WP_Hook();
    39         $tag           = __FUNCTION__;
     39        $hook_name     = __FUNCTION__;
    4040        $priority      = 1;
    4141        $accepted_args = 2;
    4242
    43         $hook->add_filter( $tag, $callback, $priority, $accepted_args );
     43        $hook->add_filter( $hook_name, $callback, $priority, $accepted_args );
    4444
    45         $this->assertSame( $priority, $hook->has_filter( $tag, $callback ) );
     45        $this->assertSame( $priority, $hook->has_filter( $hook_name, $callback ) );
    4646    }
    4747
     
    4949        $callback      = '__return_null';
    5050        $hook          = new WP_Hook();
    51         $tag           = __FUNCTION__;
     51        $hook_name     = __FUNCTION__;
    5252        $priority      = 1;
    5353        $accepted_args = 2;
    5454
    55         $hook->add_filter( $tag, $callback, $priority, $accepted_args );
     55        $hook->add_filter( $hook_name, $callback, $priority, $accepted_args );
    5656
    5757        $this->assertTrue( $hook->has_filter() );
     
    6464
    6565    public function test_not_has_filter_with_callback() {
    66         $callback = '__return_null';
    67         $hook     = new WP_Hook();
    68         $tag      = __FUNCTION__;
     66        $callback  = '__return_null';
     67        $hook      = new WP_Hook();
     68        $hook_name = __FUNCTION__;
    6969
    70         $this->assertFalse( $hook->has_filter( $tag, $callback ) );
     70        $this->assertFalse( $hook->has_filter( $hook_name, $callback ) );
    7171    }
    7272
     
    7474        $callback      = '__return_null';
    7575        $hook          = new WP_Hook();
    76         $tag           = __FUNCTION__;
     76        $hook_name     = __FUNCTION__;
    7777        $priority      = 1;
    7878        $accepted_args = 2;
    7979
    80         $hook->add_filter( $tag, $callback, $priority, $accepted_args );
     80        $hook->add_filter( $hook_name, $callback, $priority, $accepted_args );
    8181
    82         $this->assertFalse( $hook->has_filter( $tag, '__return_false' ) );
     82        $this->assertFalse( $hook->has_filter( $hook_name, '__return_false' ) );
    8383    }
    8484}
Note: See TracChangeset for help on using the changeset viewer.