Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/09/2013 01:20:02 PM (13 years ago)
Author:
boonebgorges
Message:

Put grant_super_admin() and restore_super_admins() methods in testcase

These are useful wrapper functions for setting/unsetting super admins multiple
times during tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/testcases/members/functions.php

    r7034 r7041  
    1616        parent::tearDown();
    1717        $this->set_current_user( $this->old_current_user );
    18     }
    19 
    20     /**
    21      * We can't use grant_super_admin() because we will need to modify
    22      * the list more than once, and grant_super_admin() can only be run
    23      * once because of its global check
    24      */
    25     public function grant_super_admin( $user_id ) {
    26         global $super_admins;
    27         if ( ! is_multisite() ) {
    28             return;
    29         }
    30 
    31         $user = get_userdata( $user_id );
    32         $super_admins[] = $user->user_login;
    33     }
    34 
    35     public function restore_admins() {
    36         // We assume that the global can be wiped out
    37         // @see grant_super_admin()
    38         unset( $GLOBALS['super_admins'] );
    3918    }
    4019
Note: See TracChangeset for help on using the changeset viewer.