Make WordPress Core


Ignore:
Timestamp:
08/23/2020 03:46:41 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Clear any previous term IDs from the metadata lazyloader queue in term meta lazy-loading test.

This fixes random test failures when one of the term IDs from previous tests coincides with the orphan term ID from this test that should not be lazy-loaded.

Follow-up to [34529], [36566].

Fixes #51109.

File:
1 edited

Legend:

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

    r46586 r48844  
    117117        global $wpdb;
    118118
     119        // Clear any previous term IDs from the queue.
     120        wp_metadata_lazyloader()->reset_queue( 'term' );
     121
    119122        $p = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    120123
     
    156159            }
    157160        }
     161    }
     162
     163    public static function set_cache_results( $q ) {
     164        $q->set( 'cache_results', true );
    158165    }
    159166
     
    474481    }
    475482
    476     public static function set_cache_results( $q ) {
    477         $q->set( 'cache_results', true );
    478     }
    479 
    480483    /**
    481484     * @ticket 38323
Note: See TracChangeset for help on using the changeset viewer.