Make WordPress Core


Ignore:
Timestamp:
07/31/2022 03:03:46 PM (2 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/hasFilters.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
    2020        $this->assertTrue( $hook->has_filters() );
     
    2929        $callback      = '__return_null';
    3030        $hook          = new WP_Hook();
    31         $tag           = __FUNCTION__;
     31        $hook_name     = __FUNCTION__;
    3232        $priority      = 1;
    3333        $accepted_args = 2;
    3434
    35         $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    36         $hook->remove_filter( $tag, $callback, $priority );
     35        $hook->add_filter( $hook_name, $callback, $priority, $accepted_args );
     36        $hook->remove_filter( $hook_name, $callback, $priority );
    3737        $this->assertFalse( $hook->has_filters() );
    3838    }
     
    4141        $callback      = '__return_null';
    4242        $hook          = new WP_Hook();
    43         $tag           = __FUNCTION__;
     43        $hook_name     = __FUNCTION__;
    4444        $priority      = 1;
    4545        $accepted_args = 2;
    4646
    47         $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    48         $function_key = _wp_filter_build_unique_id( $tag, $callback, $priority );
     47        $hook->add_filter( $hook_name, $callback, $priority, $accepted_args );
     48        $function_key = _wp_filter_build_unique_id( $hook_name, $callback, $priority );
    4949        unset( $hook->callbacks[ $priority ][ $function_key ] );
    5050
Note: See TracChangeset for help on using the changeset viewer.