Changeset 6583 for trunk/tests/phpunit/testcases/core/cache.php
- Timestamp:
- 06/19/2017 04:29:43 AM (9 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/testcases/core/cache.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/cache.php
r6053 r6583 8 8 9 9 /** 10 * @group jjj 10 11 * @covers ::bbp_clean_post_cache 11 12 */ … … 14 15 // Get the topic post type. 15 16 $tpt = bbp_get_topic_post_type(); 17 $rpt = bbp_get_topic_post_type(); 16 18 17 19 // Set up a forum with 1 topic and 1 reply to that topic. … … 33 35 // Make sure we've cached some data. 34 36 bbp_get_all_child_ids( $f, $tpt ); 35 bbp_get_all_child_ids( $t, $ tpt );37 bbp_get_all_child_ids( $t, $rpt ); 36 38 37 $this->assertEquals( array( $t ), wp_cache_get( "bbp_parent_all_{$f}_type_{$tpt}_child_ids", 'bbpress_posts' ) ); 38 $this->assertEquals( array( $r ), wp_cache_get( "bbp_parent_all_{$t}_type_{$tpt}_child_ids", 'bbpress_posts' ) ); 39 // Setup 40 $f_key = md5( serialize( array( 'parent_id' => $f, 'post_type' => $tpt ) ) ); 41 $t_key = md5( serialize( array( 'parent_id' => $t, 'post_type' => $rpt ) ) ); 42 $last_changed = wp_cache_get_last_changed( 'bbpress_posts' ); 43 44 // Keys 45 $f_key = "bbp_child_ids:{$f_key}:{$last_changed}"; 46 $t_key = "bbp_child_ids:{$t_key}:{$last_changed}"; 47 48 $this->assertEquals( array( $t ), wp_cache_get( $f_key, 'bbpress_posts' ) ); 49 $this->assertEquals( array( $r ), wp_cache_get( $t_key, 'bbpress_posts' ) ); 39 50 40 51 // Clean the cache. 41 52 bbp_clean_post_cache( $r ); 42 53 43 $this->assertEquals( false, wp_cache_get( "bbp_parent_all_{$f}_type_{$tpt}_child_ids", 'bbpress_posts' ) ); 44 $this->assertEquals( false, wp_cache_get( "bbp_parent_all_{$t}_type_{$tpt}_child_ids", 'bbpress_posts' ) ); 54 // Setup 55 $last_changed = wp_cache_get_last_changed( 'bbpress_posts' ); 56 57 // Keys 58 $f_key = "bbp_child_ids:{$f_key}:{$last_changed}"; 59 $t_key = "bbp_child_ids:{$t_key}:{$last_changed}"; 60 61 $this->assertEquals( false, wp_cache_get( $f_key, 'bbpress_posts' ) ); 62 $this->assertEquals( false, wp_cache_get( $t_key, 'bbpress_posts' ) ); 45 63 } 46 64 }
Note: See TracChangeset
for help on using the changeset viewer.