Changeset 53504 for trunk/tests/phpunit/tests/post/nav-menu.php
- Timestamp:
- 06/15/2022 10:18:02 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/nav-menu.php
r52389 r53504 204 204 205 205 /** 206 * @ticket 55620 207 */ 208 public function test_update_menu_item_cache_primed_post() { 209 $post_id = self::factory()->post->create(); 210 wp_update_nav_menu_item( 211 $this->menu_id, 212 0, 213 array( 214 'menu-item-type' => 'post_type', 215 'menu-item-object' => 'post', 216 'menu-item-object-id' => $post_id, 217 'menu-item-status' => 'publish', 218 ) 219 ); 220 221 $posts_query = new WP_Query(); 222 $query_result = $posts_query->query( array( 'post_type' => 'nav_menu_item' ) ); 223 224 wp_cache_delete( $post_id, 'posts' ); 225 $action = new MockAction(); 226 add_filter( 'update_post_metadata_cache', array( $action, 'filter' ), 10, 2 ); 227 228 update_menu_item_cache( $query_result ); 229 230 $args = $action->get_args(); 231 $last = end( $args ); 232 $this->assertEqualSets( array( $post_id ), $last[1], '_prime_post_caches was not executed.' ); 233 } 234 235 /** 236 * @ticket 55620 237 */ 238 public function test_update_menu_item_cache_primed_terms() { 239 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 240 $term_id = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 241 wp_update_nav_menu_item( 242 $this->menu_id, 243 0, 244 array( 245 'menu-item-type' => 'taxonomy', 246 'menu-item-object' => 'wptests_tax', 247 'menu-item-object-id' => $term_id, 248 'menu-item-status' => 'publish', 249 ) 250 ); 251 252 $posts_query = new WP_Query(); 253 $query_result = $posts_query->query( array( 'post_type' => 'nav_menu_item' ) ); 254 255 wp_cache_delete( $term_id, 'terms' ); 256 $action = new MockAction(); 257 add_filter( 'update_term_metadata_cache', array( $action, 'filter' ), 10, 2 ); 258 259 update_menu_item_cache( $query_result ); 260 261 $args = $action->get_args(); 262 $last = end( $args ); 263 $this->assertEqualSets( array( $term_id ), $last[1], '_prime_term_caches was not executed.' ); 264 } 265 266 /** 206 267 * @ticket 13910 207 268 */
Note: See TracChangeset
for help on using the changeset viewer.