Changeset 46342
- Timestamp:
- 09/29/2019 12:18:48 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite/network.php
r46314 r46342 153 153 154 154 $site_ids = self::factory()->blog->create_many( 1 ); 155 $actual = (int) get_blog_count(); // count only updated when cron runs, so unchanged155 $actual = (int) get_blog_count(); // Count only updated when cron runs, so should be unchanged. 156 156 157 157 foreach ( $site_ids as $site_id ) { … … 172 172 add_filter( 'enable_live_network_counts', '__return_false' ); 173 173 $site_ids = self::factory()->blog->create_many( 1 ); 174 $actual = (int) get_blog_count(); // count only updated when cron runs, so unchanged174 $actual = (int) get_blog_count(); // Count only updated when cron runs, so should be unchanged. 175 175 remove_filter( 'enable_live_network_counts', '__return_false' ); 176 176 … … 235 235 */ 236 236 function test_enable_live_network_user_counts_filter() { 237 // false for large networks by default237 // False for large networks by default. 238 238 add_filter( 'enable_live_network_counts', '__return_false' ); 239 239 240 // Refresh the cache 240 // Refresh the cache. 241 241 wp_update_network_counts(); 242 242 $start_count = get_user_count(); … … 244 244 wpmu_create_user( 'user', 'pass', 'email' ); 245 245 246 // No change, cache not refreshed 246 // No change, cache not refreshed. 247 247 $count = get_user_count(); 248 248 … … 266 266 $path = 'hello.php'; 267 267 268 // local activate, should be invisible for the network269 activate_plugin( $path ); // $network_wide = false268 // Local activate, should be invisible for the network. 269 activate_plugin( $path ); // Enable the plugin for the current site. 270 270 $active_plugins = wp_get_active_network_plugins(); 271 271 $this->assertEquals( array(), $active_plugins ); … … 273 273 add_action( 'deactivated_plugin', array( $this, '_helper_deactivate_hook' ) ); 274 274 275 // activate the plugin sitewide276 activate_plugin( $path, '', $network_wide = true ); 275 // Activate the plugin sitewide. 276 activate_plugin( $path, '', $network_wide = true ); // Enable the plugin for all sites in the network. 277 277 $active_plugins = wp_get_active_network_plugins(); 278 278 $this->assertEquals( array( WP_PLUGIN_DIR . '/hello.php' ), $active_plugins ); 279 279 280 // deactivate the plugin280 // Deactivate the plugin. 281 281 deactivate_plugins( $path ); 282 282 $active_plugins = wp_get_active_network_plugins(); 283 283 $this->assertEquals( array(), $active_plugins ); 284 284 285 $this->assertEquals( 1, $this->plugin_hook_count ); // testing actions and silent mode286 287 activate_plugin( $path, '', $network_wide = true ); 288 deactivate_plugins( $path, true ); // silent289 290 $this->assertEquals( 1, $this->plugin_hook_count ); // testing actions and silent mode285 $this->assertEquals( 1, $this->plugin_hook_count ); // Testing actions and silent mode. 286 287 activate_plugin( $path, '', $network_wide = true ); // Enable the plugin for all sites in the network. 288 deactivate_plugins( $path, true ); // Silent mode. 289 290 $this->assertEquals( 1, $this->plugin_hook_count ); // Testing actions and silent mode. 291 291 } 292 292 … … 299 299 add_action( 'activate_' . $path, array( $mock, 'action' ) ); 300 300 301 // should activate on the first try302 activate_plugin( $path, '', true ); 301 // Should activate on the first try. 302 activate_plugin( $path, '', true ); // Enable the plugin for all sites in the network. 303 303 $active_plugins = wp_get_active_network_plugins(); 304 304 $this->assertCount( 1, $active_plugins ); 305 305 $this->assertEquals( 1, $mock->get_call_count() ); 306 306 307 // should do nothing on the second try308 activate_plugin( $path, '', true ); 307 // Should do nothing on the second try. 308 activate_plugin( $path, '', true ); // Enable the plugin for all sites in the network. 309 309 $active_plugins = wp_get_active_network_plugins(); 310 310 $this->assertCount( 1, $active_plugins ); … … 329 329 330 330 function test_get_user_count() { 331 // Refresh the cache 331 // Refresh the cache. 332 332 wp_update_network_counts(); 333 333 $start_count = get_user_count(); 334 334 335 // Only false for large networks as of 3.7 335 // Only false for large networks as of 3.7. 336 336 add_filter( 'enable_live_network_counts', '__return_false' ); 337 337 self::factory()->user->create( array( 'role' => 'administrator' ) ); 338 338 339 $count = get_user_count(); // No change, cache not refreshed 339 $count = get_user_count(); // No change, cache not refreshed. 340 340 $this->assertEquals( $start_count, $count ); 341 341 342 wp_update_network_counts(); // Magic happens here 342 wp_update_network_counts(); // Magic happens here. 343 343 344 344 $count = get_user_count(); … … 350 350 $this->assertFalse( wp_next_scheduled( 'update_network_counts' ) ); 351 351 352 // We can't use wp_schedule_update_network_counts() because WP_INSTALLING is set 352 // We can't use wp_schedule_update_network_counts() because WP_INSTALLING is set. 353 353 wp_schedule_event( time(), 'twicedaily', 'update_network_counts' ); 354 354 … … 360 360 */ 361 361 function test_get_dashboard_blog() { 362 // if there is no dashboard blog set, current blog is used362 // If there is no dashboard blog set, current blog is used. 363 363 $dashboard_blog = get_dashboard_blog(); 364 364 $this->assertEquals( 1, $dashboard_blog->blog_id ); … … 368 368 $this->assertInternalType( 'int', $blog_id ); 369 369 370 // set the dashboard blog to another one370 // Set the dashboard blog to another one. 371 371 update_site_option( 'dashboard_blog', $blog_id ); 372 372 $dashboard_blog = get_dashboard_blog(); … … 648 648 649 649 /** 650 * Gets the ID of the site with the highest ID 650 * Gets the ID of the site with the highest ID. 651 651 * @return int 652 652 */ 653 653 protected function _get_next_network_id() { 654 654 global $wpdb; 655 // create an extra network, just to make sure we know the ID of the following one655 // Create an extra network, just to make sure we know the ID of the following one. 656 656 static::factory()->network->create(); 657 657 return (int) $wpdb->get_var( 'SELECT id FROM ' . $wpdb->site . ' ORDER BY id DESC LIMIT 1' ) + 1;
Note: See TracChangeset
for help on using the changeset viewer.