WordPress.org

Make WordPress Core

Changeset 46342


Ignore:
Timestamp:
09/29/2019 12:18:48 PM (2 months ago)
Author:
SergeyBiryukov
Message:

Docs: Improve comments in tests/multisite/network.php per the documentation standards.

Props garrett-eclipse, jrf.
See #48142.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/multisite/network.php

    r46314 r46342  
    153153
    154154            $site_ids = self::factory()->blog->create_many( 1 );
    155             $actual   = (int) get_blog_count(); // count only updated when cron runs, so unchanged
     155            $actual   = (int) get_blog_count(); // Count only updated when cron runs, so should be unchanged.
    156156
    157157            foreach ( $site_ids as $site_id ) {
     
    172172            add_filter( 'enable_live_network_counts', '__return_false' );
    173173            $site_ids = self::factory()->blog->create_many( 1 );
    174             $actual   = (int) get_blog_count(); // count only updated when cron runs, so unchanged
     174            $actual   = (int) get_blog_count(); // Count only updated when cron runs, so should be unchanged.
    175175            remove_filter( 'enable_live_network_counts', '__return_false' );
    176176
     
    235235         */
    236236        function test_enable_live_network_user_counts_filter() {
    237             // false for large networks by default
     237            // False for large networks by default.
    238238            add_filter( 'enable_live_network_counts', '__return_false' );
    239239
    240             // Refresh the cache
     240            // Refresh the cache.
    241241            wp_update_network_counts();
    242242            $start_count = get_user_count();
     
    244244            wpmu_create_user( 'user', 'pass', 'email' );
    245245
    246             // No change, cache not refreshed
     246            // No change, cache not refreshed.
    247247            $count = get_user_count();
    248248
     
    266266            $path = 'hello.php';
    267267
    268             // local activate, should be invisible for the network
    269             activate_plugin( $path ); // $network_wide = false
     268            // Local activate, should be invisible for the network.
     269            activate_plugin( $path ); // Enable the plugin for the current site.
    270270            $active_plugins = wp_get_active_network_plugins();
    271271            $this->assertEquals( array(), $active_plugins );
     
    273273            add_action( 'deactivated_plugin', array( $this, '_helper_deactivate_hook' ) );
    274274
    275             // activate the plugin sitewide
    276             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.
    277277            $active_plugins                           = wp_get_active_network_plugins();
    278278            $this->assertEquals( array( WP_PLUGIN_DIR . '/hello.php' ), $active_plugins );
    279279
    280             //deactivate the plugin
     280            // Deactivate the plugin.
    281281            deactivate_plugins( $path );
    282282            $active_plugins = wp_get_active_network_plugins();
    283283            $this->assertEquals( array(), $active_plugins );
    284284
    285             $this->assertEquals( 1, $this->plugin_hook_count ); // testing actions and silent mode
    286 
    287             activate_plugin( $path, '', $network_wide = true );
    288             deactivate_plugins( $path, true ); // silent
    289 
    290             $this->assertEquals( 1, $this->plugin_hook_count ); // testing actions and silent mode
     285            $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.
    291291        }
    292292
     
    299299            add_action( 'activate_' . $path, array( $mock, 'action' ) );
    300300
    301             // should activate on the first try
    302             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.
    303303            $active_plugins = wp_get_active_network_plugins();
    304304            $this->assertCount( 1, $active_plugins );
    305305            $this->assertEquals( 1, $mock->get_call_count() );
    306306
    307             // should do nothing on the second try
    308             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.
    309309            $active_plugins = wp_get_active_network_plugins();
    310310            $this->assertCount( 1, $active_plugins );
     
    329329
    330330        function test_get_user_count() {
    331             // Refresh the cache
     331            // Refresh the cache.
    332332            wp_update_network_counts();
    333333            $start_count = get_user_count();
    334334
    335             // Only false for large networks as of 3.7
     335            // Only false for large networks as of 3.7.
    336336            add_filter( 'enable_live_network_counts', '__return_false' );
    337337            self::factory()->user->create( array( 'role' => 'administrator' ) );
    338338
    339             $count = get_user_count(); // No change, cache not refreshed
     339            $count = get_user_count(); // No change, cache not refreshed.
    340340            $this->assertEquals( $start_count, $count );
    341341
    342             wp_update_network_counts(); // Magic happens here
     342            wp_update_network_counts(); // Magic happens here.
    343343
    344344            $count = get_user_count();
     
    350350            $this->assertFalse( wp_next_scheduled( 'update_network_counts' ) );
    351351
    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.
    353353            wp_schedule_event( time(), 'twicedaily', 'update_network_counts' );
    354354
     
    360360         */
    361361        function test_get_dashboard_blog() {
    362             // if there is no dashboard blog set, current blog is used
     362            // If there is no dashboard blog set, current blog is used.
    363363            $dashboard_blog = get_dashboard_blog();
    364364            $this->assertEquals( 1, $dashboard_blog->blog_id );
     
    368368            $this->assertInternalType( 'int', $blog_id );
    369369
    370             // set the dashboard blog to another one
     370            // Set the dashboard blog to another one.
    371371            update_site_option( 'dashboard_blog', $blog_id );
    372372            $dashboard_blog = get_dashboard_blog();
     
    648648
    649649        /**
    650          * Gets the ID of the site with the highest ID
     650         * Gets the ID of the site with the highest ID.
    651651         * @return int
    652652         */
    653653        protected function _get_next_network_id() {
    654654            global $wpdb;
    655             //create an extra network, just to make sure we know the ID of the following one
     655            // Create an extra network, just to make sure we know the ID of the following one.
    656656            static::factory()->network->create();
    657657            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.