factory->forum->create(); $t = $this->factory->topic->create( array( 'post_parent' => $f, 'topic_meta' => array( 'forum_id' => $f, ), ) ); $r = $this->factory->reply->create( array( 'post_parent' => $t, 'reply_meta' => array( 'forum_id' => $f, 'topic_id' => $t, ), ) ); // Make sure we've cached some data. bbp_get_all_child_ids( $f, $tpt ); bbp_get_all_child_ids( $t, $rpt ); // Setup $f_key = md5( serialize( array( 'parent_id' => $f, 'post_type' => $tpt ) ) ); $t_key = md5( serialize( array( 'parent_id' => $t, 'post_type' => $rpt ) ) ); $last_changed = wp_cache_get_last_changed( 'bbpress_posts' ); // Keys $f_key = "bbp_child_ids:{$f_key}:{$last_changed}"; $t_key = "bbp_child_ids:{$t_key}:{$last_changed}"; $this->assertEquals( array( $t ), wp_cache_get( $f_key, 'bbpress_posts' ) ); $this->assertEquals( array( $r ), wp_cache_get( $t_key, 'bbpress_posts' ) ); // Clean the reply cache. clean_post_cache( $r ); // Setup $last_changed = wp_cache_get_last_changed( 'bbpress_posts' ); // Keys $f_key = "bbp_child_ids:{$f_key}:{$last_changed}"; $t_key = "bbp_child_ids:{$t_key}:{$last_changed}"; $this->assertEquals( false, wp_cache_get( $f_key, 'bbpress_posts' ) ); $this->assertEquals( false, wp_cache_get( $t_key, 'bbpress_posts' ) ); } }