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. git-svn-id: https://develop.svn.wordpress.org/trunk@48844 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
380145e073
commit
c90037ca47
@ -116,6 +116,9 @@ class Tests_Term_Meta extends WP_UnitTestCase {
|
||||
public function test_term_meta_should_be_lazy_loaded_for_all_terms_in_wp_query_loop() {
|
||||
global $wpdb;
|
||||
|
||||
// Clear any previous term IDs from the queue.
|
||||
wp_metadata_lazyloader()->reset_queue( 'term' );
|
||||
|
||||
$p = self::factory()->post->create( array( 'post_status' => 'publish' ) );
|
||||
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
@ -157,6 +160,10 @@ class Tests_Term_Meta extends WP_UnitTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public static function set_cache_results( $q ) {
|
||||
$q->set( 'cache_results', true );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 36593
|
||||
*/
|
||||
@ -473,10 +480,6 @@ class Tests_Term_Meta extends WP_UnitTestCase {
|
||||
$this->assertSame( array(), $meta );
|
||||
}
|
||||
|
||||
public static function set_cache_results( $q ) {
|
||||
$q->set( 'cache_results', true );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 38323
|
||||
* @dataProvider data_register_term_meta
|
||||
|
Loading…
Reference in New Issue
Block a user