Make WordPress Core


Ignore:
Timestamp:
07/31/2022 03:03:46 PM (4 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/doAction.php

    r52389 r53804  
    2121        $callback      = array( $a, 'action' );
    2222        $hook          = new WP_Hook();
    23         $tag           = __FUNCTION__;
     23        $hook_name     = __FUNCTION__;
    2424        $priority      = 1;
    2525        $accepted_args = 2;
    2626        $arg           = __FUNCTION__ . '_arg';
    2727
    28         $hook->add_filter( $tag, $callback, $priority, $accepted_args );
     28        $hook->add_filter( $hook_name, $callback, $priority, $accepted_args );
    2929        $hook->do_action( array( $arg ) );
    3030
     
    3636        $callback      = array( $a, 'filter' );
    3737        $hook          = new WP_Hook();
    38         $tag           = __FUNCTION__;
     38        $hook_name     = __FUNCTION__;
    3939        $priority      = 1;
    4040        $accepted_args = 2;
    4141        $arg           = __FUNCTION__ . '_arg';
    4242
    43         $hook->add_filter( $tag, $callback, $priority, $accepted_args );
     43        $hook->add_filter( $hook_name, $callback, $priority, $accepted_args );
    4444        $hook->do_action( array( $arg ) );
    4545        $hook->do_action( array( $arg ) );
     
    5454        $callback_two  = array( $b, 'filter' );
    5555        $hook          = new WP_Hook();
    56         $tag           = __FUNCTION__;
     56        $hook_name     = __FUNCTION__;
    5757        $priority      = 1;
    5858        $accepted_args = 2;
    5959        $arg           = __FUNCTION__ . '_arg';
    6060
    61         $hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
    62         $hook->add_filter( $tag, $callback_two, $priority, $accepted_args );
     61        $hook->add_filter( $hook_name, $callback_one, $priority, $accepted_args );
     62        $hook->add_filter( $hook_name, $callback_two, $priority, $accepted_args );
    6363        $hook->do_action( array( $arg ) );
    6464
     
    7373        $callback_two  = array( $b, 'filter' );
    7474        $hook          = new WP_Hook();
    75         $tag           = __FUNCTION__;
     75        $hook_name     = __FUNCTION__;
    7676        $priority      = 1;
    7777        $accepted_args = 2;
    7878        $arg           = __FUNCTION__ . '_arg';
    7979
    80         $hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
    81         $hook->add_filter( $tag, $callback_two, $priority + 1, $accepted_args );
     80        $hook->add_filter( $hook_name, $callback_one, $priority, $accepted_args );
     81        $hook->add_filter( $hook_name, $callback_two, $priority + 1, $accepted_args );
    8282        $hook->do_action( array( $arg ) );
    8383
     
    8989        $callback      = array( $this, '_action_callback' );
    9090        $hook          = new WP_Hook();
    91         $tag           = __FUNCTION__;
     91        $hook_name     = __FUNCTION__;
    9292        $priority      = 1;
    9393        $accepted_args = 0;
    9494        $arg           = __FUNCTION__ . '_arg';
    9595
    96         $hook->add_filter( $tag, $callback, $priority, $accepted_args );
     96        $hook->add_filter( $hook_name, $callback, $priority, $accepted_args );
    9797        $hook->do_action( array( $arg ) );
    9898
     
    103103        $callback      = array( $this, '_action_callback' );
    104104        $hook          = new WP_Hook();
    105         $tag           = __FUNCTION__;
     105        $hook_name     = __FUNCTION__;
    106106        $priority      = 1;
    107107        $accepted_args = 1;
    108108        $arg           = __FUNCTION__ . '_arg';
    109109
    110         $hook->add_filter( $tag, $callback, $priority, $accepted_args );
     110        $hook->add_filter( $hook_name, $callback, $priority, $accepted_args );
    111111        $hook->do_action( array( $arg ) );
    112112
     
    117117        $callback      = array( $this, '_action_callback' );
    118118        $hook          = new WP_Hook();
    119         $tag           = __FUNCTION__;
     119        $hook_name     = __FUNCTION__;
    120120        $priority      = 100;
    121121        $accepted_args = 1000;
    122122        $arg           = __FUNCTION__ . '_arg';
    123123
    124         $hook->add_filter( $tag, $callback, $priority, $accepted_args );
     124        $hook->add_filter( $hook_name, $callback, $priority, $accepted_args );
    125125        $hook->do_action( array( $arg ) );
    126126
Note: See TracChangeset for help on using the changeset viewer.