Changeset 37233 for trunk/tests/phpunit/tests/multisite/network.php
- Timestamp:
- 04/18/2016 01:28:56 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite/network.php
r35242 r37233 87 87 * @ticket 22917 88 88 */ 89 function test_enable_live_network_site_counts_filter() { 89 public function test_get_blog_count_no_filter_applied() { 90 wp_update_network_counts(); 90 91 $site_count_start = get_blog_count(); 91 // false for large networks by default 92 add_filter( 'enable_live_network_counts', '__return_false' ); 93 self::factory()->blog->create_many( 4 ); 94 95 // count only updated when cron runs, so unchanged 96 $this->assertEquals( $site_count_start, (int) get_blog_count() ); 97 98 add_filter( 'enable_live_network_counts', '__return_true' ); 99 $site_ids = self::factory()->blog->create_many( 4 ); 100 101 $this->assertEquals( $site_count_start + 9, (int) get_blog_count() ); 102 103 //clean up 104 remove_filter( 'enable_live_network_counts', '__return_false' ); 105 remove_filter( 'enable_live_network_counts', '__return_true' ); 92 93 $site_ids = self::factory()->blog->create_many( 1 ); 94 $actual = (int) get_blog_count(); // count only updated when cron runs, so unchanged 95 106 96 foreach ( $site_ids as $site_id ) { 107 97 wpmu_delete_blog( $site_id, true ); 108 98 } 109 } 99 wp_update_network_counts(); 100 101 $this->assertEquals( $site_count_start + 1, $actual ); 102 } 103 104 /** 105 * @ticket 22917 106 */ 107 public function test_get_blog_count_enable_live_network_counts_false() { 108 wp_update_network_counts(); 109 $site_count_start = get_blog_count(); 110 111 add_filter( 'enable_live_network_counts', '__return_false' ); 112 $site_ids = self::factory()->blog->create_many( 1 ); 113 $actual = (int) get_blog_count(); // count only updated when cron runs, so unchanged 114 remove_filter( 'enable_live_network_counts', '__return_false' ); 115 116 foreach ( $site_ids as $site_id ) { 117 wpmu_delete_blog( $site_id, true ); 118 } 119 wp_update_network_counts(); 120 121 $this->assertEquals( $site_count_start, $actual ); 122 } 123 124 /** 125 * @ticket 22917 126 */ 127 public function test_get_blog_count_enabled_live_network_counts_true() { 128 wp_update_network_counts(); 129 $site_count_start = get_blog_count(); 130 131 add_filter( 'enable_live_network_counts', '__return_true' ); 132 $site_ids = self::factory()->blog->create_many( 1 ); 133 $actual = get_blog_count(); 134 remove_filter( 'enable_live_network_counts', '__return_true' ); 135 136 foreach ( $site_ids as $site_id ) { 137 wpmu_delete_blog( $site_id, true ); 138 } 139 wp_update_network_counts(); 140 141 $this->assertEquals( $site_count_start + 1, $actual ); 142 } 143 110 144 /** 111 145 * @ticket 22917
Note: See TracChangeset
for help on using the changeset viewer.