diff --git tests/phpunit/testcases/blogs/functions.php tests/phpunit/testcases/blogs/functions.php
index b2ee4eb..b23974e 100644
|
|
class BP_Tests_Blogs_Functions extends BP_UnitTestCase { |
619 | 619 | |
620 | 620 | return ! empty( $a['activities'] ); |
621 | 621 | } |
| 622 | |
| 623 | /** |
| 624 | * @group counts |
| 625 | */ |
| 626 | public function test_get_total_blog_count_zero_cache() { |
| 627 | if ( ! is_multisite() ) { |
| 628 | return; |
| 629 | } |
| 630 | |
| 631 | global $wpdb; |
| 632 | |
| 633 | // prime cache |
| 634 | // no blogs are created |
| 635 | bp_blogs_total_blogs(); |
| 636 | $first_query = $wpdb->num_queries; |
| 637 | |
| 638 | // check again |
| 639 | // see if we check the cached count or if we hit the DB |
| 640 | bp_blogs_total_blogs(); |
| 641 | $second_query = $wpdb->num_queries; |
| 642 | |
| 643 | $this->assertEquals( $first_query, $second_query ); |
| 644 | } |
622 | 645 | } |
diff --git tests/phpunit/testcases/groups/functions.php tests/phpunit/testcases/groups/functions.php
index 6433349..e9109fb 100644
|
|
Bar!'; |
647 | 647 | groups_accept_invite( $u2, $g ); |
648 | 648 | $this->assertEquals( 0, groups_get_invite_count_for_user( $u2 ) ); |
649 | 649 | } |
| 650 | |
| 651 | /** |
| 652 | * @group counts |
| 653 | */ |
| 654 | public function test_get_total_group_count_zero_cache() { |
| 655 | global $wpdb; |
| 656 | |
| 657 | // prime cache |
| 658 | // no groups are created |
| 659 | groups_get_total_group_count(); |
| 660 | $first_query = $wpdb->num_queries; |
| 661 | |
| 662 | // check again |
| 663 | // see if we check the cached count or if we hit the DB |
| 664 | groups_get_total_group_count(); |
| 665 | $second_query = $wpdb->num_queries; |
| 666 | |
| 667 | $this->assertEquals( $first_query, $second_query ); |
| 668 | } |
650 | 669 | } |
diff --git tests/phpunit/testcases/members/functions.php tests/phpunit/testcases/members/functions.php
index 4ce1b28..ab2e9fb 100644
|
|
class BP_Tests_Members_Functions extends BP_UnitTestCase { |
445 | 445 | global $wpdb; |
446 | 446 | return $wpdb->prefix . $key; |
447 | 447 | } |
| 448 | |
| 449 | /** |
| 450 | * @group bp_core_get_total_member_count |
| 451 | * @group cache |
| 452 | */ |
| 453 | public function test_bp_core_get_total_member_count_should_respect_cached_value_of_0() { |
| 454 | global $wpdb; |
| 455 | wp_cache_set( 'bp_total_member_count', 0, 'bp' ); |
| 456 | |
| 457 | $num_queries = $wpdb->num_queries; |
| 458 | |
| 459 | $this->assertEquals( 0, bp_core_get_total_member_count() ); |
| 460 | $this->assertEquals( $num_queries, $wpdb->num_queries ); |
| 461 | } |
448 | 462 | } |