Changeset 41623
- Timestamp:
- 09/27/2017 05:41:31 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/functions.php
r41613 r41623 1162 1162 } 1163 1163 1164 /**1165 * @ticket 387411166 */1167 public function test_wp_get_active_user_count() {1168 $user_count = wp_get_active_user_count();1169 $this->assertSame( $user_count, 1 );1170 1171 // make twenty additional users to make 21 users1172 self::factory()->user->create_many( 20 );1173 1174 $user_count = wp_get_active_user_count();1175 $this->assertSame( $user_count, 21 );1176 }1177 1178 /**1179 * @ticket 387411180 */1181 public function test_wp_get_active_user_count_caching() {1182 global $wpdb;1183 1184 // Ensure we start with 1 user1185 $user_count = wp_get_active_user_count();1186 $this->assertSame( $user_count, 1 );1187 1188 self::factory()->user->create();1189 1190 delete_option( 'active_user_count' );1191 1192 // Ensure we now have 2 users1193 $user_count = wp_get_active_user_count();1194 $this->assertSame( $user_count, 2 );1195 1196 $queries = $wpdb->num_queries;1197 1198 // Ensure that caching inside wp_get_active_user_count() works as expected1199 $user_count = wp_get_active_user_count();1200 $this->assertSame( $user_count, 2 );1201 $this->assertSame( $queries, $wpdb->num_queries );1202 }1203 1204 /**1205 * @ticket 387411206 */1207 public function test_wp_is_large_user_count() {1208 // set the 'active_user_count' value to over 10000 to emulate a large site1209 update_option( 'active_user_count', 10001 );1210 $user_count = wp_get_active_user_count();1211 $this->assertSame( $user_count, 10001 );1212 $this->assertTrue( wp_is_large_user_count() );1213 1214 delete_option( 'active_user_count' );1215 $this->assertFalse( wp_is_large_user_count() );1216 }1217 1164 }
Note: See TracChangeset
for help on using the changeset viewer.