- Timestamp:
- 10/12/2023 11:39:05 PM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/primePostParentsCaches.php
r56811 r56925 43 43 44 44 $this->assertSame( 1, $num_queries, 'Unexpected number of queries.' ); 45 $this->assertSameSets( array( 0 ), wp_cache_get_multiple( array( $post_id ), 'post_parent' ), 'Array of parent ids' );45 $this->assertSameSets( array( 0 ), wp_cache_get_multiple( array( "post_parent:{$post_id}" ), 'posts' ), 'Array of parent ids' ); 46 46 } 47 47 … … 54 54 $num_queries = get_num_queries() - $before_num_queries; 55 55 56 $cache_keys = array_map( 57 function ( $post_id ) { 58 return "post_parent:{$post_id}"; 59 }, 60 self::$posts 61 ); 62 56 63 $this->assertSame( 1, $num_queries, 'Unexpected number of queries.' ); 57 $this->assertSameSets( array( 0, 0, 0 ), wp_cache_get_multiple( self::$posts, 'post_parent' ), 'Array of parent ids' );64 $this->assertSameSets( array( 0, 0, 0 ), wp_cache_get_multiple( $cache_keys, 'posts' ), 'Array of parent ids' ); 58 65 } 59 66 … … 85 92 86 93 $this->assertSame( 1, $num_queries, 'Unexpected number of queries on first run' ); 87 $this->assertSameSets( array( self::$posts[0] ), wp_cache_get_multiple( array( $page_id ), 'post_parent' ), 'Array of parent ids with post 0 as parent' );94 $this->assertSameSets( array( self::$posts[0] ), wp_cache_get_multiple( array( "post_parent:{$page_id}" ), 'posts' ), 'Array of parent ids with post 0 as parent' ); 88 95 89 96 wp_update_post( … … 99 106 100 107 $this->assertSame( 1, $num_queries, 'Unexpected number of queries on second run' ); 101 $this->assertSameSets( array( self::$posts[1] ), wp_cache_get_multiple( array( $page_id ), 'post_parent' ), 'Array of parent ids with post 1 as parent' );108 $this->assertSameSets( array( self::$posts[1] ), wp_cache_get_multiple( array( "post_parent:{$page_id}" ), 'posts' ), 'Array of parent ids with post 1 as parent' ); 102 109 } 103 110 … … 122 129 123 130 $this->assertSame( 1, $num_queries, 'Unexpected number of queries on first run' ); 124 $this->assertSameSets( array( $parent_page_id ), wp_cache_get_multiple( array( $page_id ), 'post_parent' ), 'Array of parent ids with post 0 as parent' );131 $this->assertSameSets( array( $parent_page_id ), wp_cache_get_multiple( array( "post_parent:{$page_id}" ), 'posts' ), 'Array of parent ids with post 0 as parent' ); 125 132 126 133 wp_delete_post( $parent_page_id, true ); 127 134 128 135 $this->assertSame( 1, $num_queries, 'Unexpected number of queries on second run' ); 129 $this->assertSameSets( array( false ), wp_cache_get_multiple( array( $page_id ), 'post_parent' ), 'Array of parent ids with false values' );136 $this->assertSameSets( array( false ), wp_cache_get_multiple( array( "post_parent:{$page_id}" ), 'posts' ), 'Array of parent ids with false values' ); 130 137 } 131 138 }
Note: See TracChangeset
for help on using the changeset viewer.