Make WordPress Core

Changeset 58919


Ignore:
Timestamp:
08/20/2024 08:05:21 PM (7 months ago)
Author:
hellofromTonya
Message:

Tests: Remove WP_Term::$filter property unset() within term tests.

Removes the unset() of the WP_Term::$filter property within the term tests.

Why?

Prior to the introduction of WP_Term, the term was added to the cache when its filter property was empty. To test the cache, the tests unset this property to trigger wp_cache_add() in get_term(). [34997] changed that behavior to trigger wp_cache_add() when the term was not found after wp_cache_get() (i.e. happened in WP_Term::get_instance()).

Unsetting the filter property is and was not needed. Prior to WP_Term, the condition was an empty value. With WP_Term, the filter property is no longer part of the conditional logic for caching.

Follow-up to [34997], [30954], [34035].

See #61890, #61530.

Location:
trunk/tests/phpunit/tests/term
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/term/cache.php

    r57987 r58919  
    117117        $num_queries = get_num_queries();
    118118
    119         // get_term() will only be update the cache if the 'filter' prop is unset.
    120         unset( $term_object->filter );
    121 
    122119        $term_object_2 = get_term( $term_object, 'wptests_tax' );
    123120
  • trunk/tests/phpunit/tests/term/getTerm.php

    r56549 r58919  
    9999        $num_queries = get_num_queries();
    100100
    101         unset( $term->filter );
    102101        $term_a = get_term( $term, 'wptests_tax' );
    103102
Note: See TracChangeset for help on using the changeset viewer.