Make WordPress Core

Changeset 57799


Ignore:
Timestamp:
03/11/2024 12:52:18 PM (7 weeks ago)
Author:
Bernhard Reiter
Message:

Block Hooks: Remove filter global reset from test teardown.

Resetting the $wp_current_filter global during test teardown is unnecessary, as it is taken care of by the unit test's base class.

This changeset removes the reset accordingly.

Follow-up [57790].
Props swissspidy, timothyblynjacobs.
See #60671.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/block-template-utils.php

    r57790 r57799  
    9393     */
    9494    public function tear_down() {
    95         global $wp_current_filter;
    96 
    97         if (
    98             'rest_pre_insert_wp_template' === current_filter() ||
    99             'rest_pre_insert_wp_template_part' === current_filter()
    100         ) {
    101             array_pop( $wp_current_filter );
    102         }
    103 
    10495        if ( WP_Block_Type_Registry::get_instance()->is_registered( 'tests/hooked-block' ) ) {
    10596            unregister_block_type( 'tests/hooked-block' );
     
    421412    public function test_inject_ignored_hooked_blocks_metadata_attributes_into_template() {
    422413        global $wp_current_filter;
    423         // Mock currently set filter.
     414        // Mock currently set filter. The $wp_current_filter global is reset during teardown by
     415        // WP_UnitTestCase_Base::_restore_hooks() in tests/phpunit/includes/abstract-testcase.php.
    424416        $wp_current_filter[] = 'rest_pre_insert_wp_template';
    425417
     
    454446    public function test_inject_ignored_hooked_blocks_metadata_attributes_into_template_part() {
    455447        global $wp_current_filter;
    456         // Mock currently set filter.
     448        // Mock currently set filter. The $wp_current_filter global is reset during teardown by
     449        // WP_UnitTestCase_Base::_restore_hooks() in tests/phpunit/includes/abstract-testcase.php.
    457450        $wp_current_filter[] = 'rest_pre_insert_wp_template_part';
    458451
Note: See TracChangeset for help on using the changeset viewer.