Skip to:
Content

BuddyPress.org

Ticket #8251: 8251.diff

File 8251.diff, 2.0 KB (added by fahimmurshed, 4 years ago)

Patch

  • testcase.php

     
    6060
    6161                $this->factory = new BP_UnitTest_Factory;
    6262
    63                 // Fixes warnings in multisite functions
     63                // Fixes warnings in multisite functions.
    6464                $_SERVER['REMOTE_ADDR'] = '';
    6565                global $wpdb;
    6666
     
    6767                // Clean up after autocommits.
    6868                add_action( 'bp_blogs_recorded_existing_blogs', array( $this, 'set_autocommit_flag' ) );
    6969
    70                 // Make sure Activity actions are reset before each test
     70                // Make sure Activity actions are reset before each test.
    7171                $this->reset_bp_activity_actions();
    7272
    73                 // Make sure all Post types activities globals are reset before each test
     73                // Make sure all Post types activities globals are reset before each test.
    7474                $this->reset_bp_activity_post_types_globals();
    7575        }
    7676
     
    205205        /**
    206206         * WP's core tests use wp_set_current_user() to change the current
    207207         * user during tests. BP caches the current user differently, so we
    208          * have to do a bit more work to change it
     208         * have to do a bit more work to change it.
    209209         */
    210210        public static function set_current_user( $user_id ) {
    211211                $bp = buddypress();
     
    248248        /**
    249249         * We can't use grant_super_admin() because we will need to modify
    250250         * the list more than once, and grant_super_admin() can only be run
    251          * once because of its global check
     251         * once because of its global check.
    252252         */
    253253        public function grant_super_admin( $user_id ) {
    254254                global $super_admins;
     
    261261        }
    262262
    263263        public function restore_admins() {
    264                 // We assume that the global can be wiped out
     264                // We assume that the global can be wiped out.
    265265                // @see grant_super_admin()
    266266                unset( $GLOBALS['super_admins'] );
    267267        }
     
    343343         * Clean up created directories/files
    344344         */
    345345        public function rrmdir( $dir ) {
    346                 // Make sure we are only removing files/dir from uploads
     346                // Make sure we are only removing files/dir from uploads.
    347347                if ( 0 !== strpos( $dir, bp_core_avatar_upload_path() ) ) {
    348348                        return;
    349349                }