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/preinitHooks.php

    r52389 r53804  
    1010
    1111    public function test_array_to_hooks() {
    12         $tag1      = __FUNCTION__ . '_1';
    13         $priority1 = 1;
    14         $tag2      = __FUNCTION__ . '_2';
    15         $priority2 = 2;
    16         $filters   = array(
    17             $tag1 => array(
     12        $hook_name1 = __FUNCTION__ . '_1';
     13        $priority1  = 1;
     14        $hook_name2 = __FUNCTION__ . '_2';
     15        $priority2  = 2;
     16        $filters    = array(
     17            $hook_name1 => array(
    1818                $priority1 => array(
    1919                    'test1' => array(
     
    2323                ),
    2424            ),
    25             $tag2 => array(
     25            $hook_name2 => array(
    2626                $priority2 => array(
    2727                    'test1' => array(
     
    3535        $hooks = WP_Hook::build_preinitialized_hooks( $filters );
    3636
    37         $this->assertSame( $priority1, $hooks[ $tag1 ]->has_filter( $tag1, '__return_false' ) );
    38         $this->assertSame( $priority2, $hooks[ $tag2 ]->has_filter( $tag2, '__return_null' ) );
     37        $this->assertSame( $priority1, $hooks[ $hook_name1 ]->has_filter( $hook_name1, '__return_false' ) );
     38        $this->assertSame( $priority2, $hooks[ $hook_name2 ]->has_filter( $hook_name2, '__return_null' ) );
    3939    }
    4040}
Note: See TracChangeset for help on using the changeset viewer.