Skip to:
Content

BuddyPress.org

Changeset 9139


Ignore:
Timestamp:
11/14/2014 02:01:18 PM (6 years ago)
Author:
boonebgorges
Message:

In automated tests, move user creation to a proper factory method.

BP user creation requires that a couple of extra pieces of data be set up
(last activity, display name, etc). So we previously had a wrapper in
BP_UnitTestCase called create_user() that performed the extra setup.
However, the wrapper made it impossible to use create_user() statically,
because the user_login and user_email iterator was not persistent from call to
call. (The create_user() syntax is also a break with the rest of our unit
tests, which is not ideal.)

This changeset introduces BP_UnitTest_Factory_For_User, which reproduces the
customizations of create_user(), but in a proper factory method. All
instances of create_user() throughout the test suite have also been replaced.

See #6009.

Location:
trunk/tests/phpunit
Files:
41 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/factory.php

    r9120 r9139  
    66        parent::__construct();
    77
     8        $this->user = new BP_UnitTest_Factory_For_User( $this );
    89        $this->activity = new BP_UnitTest_Factory_For_Activity( $this );
    910        $this->group = new BP_UnitTest_Factory_For_Group( $this );
     
    1617}
    1718
     19class BP_UnitTest_Factory_For_User extends WP_UnitTest_Factory_For_User {
     20    /**
     21     * When creating a new user, it's almost always necessary to have the
     22     * last_activity usermeta set right away, so that the user shows up in
     23     * directory queries. This is a shorthand wrapper for the user factory
     24     * create() method.
     25     *
     26     * Also set a display name
     27     */
     28    public function create_object( $args ) {
     29        $r = wp_parse_args( $args, array(
     30            'role' => 'subscriber',
     31            'last_activity' => date( 'Y-m-d H:i:s', strtotime( bp_core_current_time() ) - 60*60*24*365 ),
     32        ) );
     33
     34        $last_activity = $r['last_activity'];
     35        unset( $r['last_activity'] );
     36
     37        $user_id = wp_insert_user( $r );
     38
     39        bp_update_user_last_activity( $user_id, $last_activity );
     40
     41        if ( bp_is_active( 'xprofile' ) ) {
     42            $user = new WP_User( $user_id );
     43            xprofile_set_field_data( 1, $user_id, $user->display_name );
     44        }
     45
     46        return $user_id;
     47    }
     48}
     49
    1850class BP_UnitTest_Factory_For_Activity extends WP_UnitTest_Factory_For_Thing {
    1951
  • trunk/tests/phpunit/includes/testcase.php

    r9138 r9139  
    319319    }
    320320
    321     /**
    322      * When creating a new user, it's almost always necessary to have the
    323      * last_activity usermeta set right away, so that the user shows up in
    324      * directory queries. This is a shorthand wrapper for the user factory
    325      * create() method.
    326      *
    327      * Also set a display name
    328      */
    329     function create_user( $args = array() ) {
    330         $r = wp_parse_args( $args, array(
    331             'role' => 'subscriber',
    332             'last_activity' => date( 'Y-m-d H:i:s', strtotime( bp_core_current_time() ) - 60*60*24*365 ),
    333         ) );
    334 
    335         $last_activity = $r['last_activity'];
    336         unset( $r['last_activity'] );
    337 
    338         $user_id = $this->factory->user->create( $r );
    339 
    340         bp_update_user_last_activity( $user_id, $last_activity );
    341 
    342         if ( bp_is_active( 'xprofile' ) ) {
    343             $user = new WP_User( $user_id );
    344             xprofile_set_field_data( 1, $user_id, $user->display_name );
    345         }
    346 
    347         return $user_id;
    348     }
    349 
    350321    public static function add_user_to_group( $user_id, $group_id, $args = array() ) {
    351322        $r = wp_parse_args( $args, array(
  • trunk/tests/phpunit/testcases/activity/class.BP_Activity_Activity.php

    r8958 r9139  
    1010
    1111        $this->old_current_user = get_current_user_id();
    12         $this->set_current_user( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
     12        $this->set_current_user( $this->factory->user->create( array(
     13            'role' => 'subscriber',
     14        ) ) );
    1315    }
    1416
     
    518520    public function test_get_activity_comments_format() {
    519521        $now = time();
    520         $u1 = $this->create_user();
    521         $u2 = $this->create_user();
     522
     523        $u1 = $this->factory->user->create();
     524        $u2 = $this->factory->user->create();
    522525
    523526        $a1 = $this->factory->activity->create( array(
  • trunk/tests/phpunit/testcases/activity/filters.php

    r8958 r9139  
    1010     */
    1111    public function test_bp_activity_at_name_filter() {
    12         $u1 = $this->create_user( array(
     12        $u1 = $this->factory->user->create( array(
    1313            'user_login' => 'foobarbaz',
    1414            'user_nicename' => 'foobarbaz',
    1515        ) );
    1616
    17         $u2 = $this->create_user( array(
     17        $u2 = $this->factory->user->create( array(
    1818            'user_login' => 'foo2',
    1919            'user_nicename' => 'foo2',
  • trunk/tests/phpunit/testcases/activity/functions.php

    r9052 r9139  
    453453        add_filter( 'bp_is_username_compatibility_mode', '__return_false' );
    454454
    455         $u = $this->create_user( array(
     455        $u = $this->factory->user->create( array(
    456456            'user_login' => 'foo bar baz',
    457457            'user_nicename' => 'foo-bar-baz',
     
    469469        add_filter( 'bp_is_username_compatibility_mode', '__return_true' );
    470470
    471         $u1 = $this->create_user( array(
     471        $u1 = $this->factory->user->create( array(
    472472            'user_login' => 'foo bar baz',
    473473            'user_nicename' => 'foo-bar-baz',
    474474        ) );
    475475
    476         $u2 = $this->create_user( array(
     476        $u2 = $this->factory->user->create( array(
    477477            'user_login' => 'foo.bar.baz',
    478478            'user_nicename' => 'foo-bar-baz',
     
    491491        add_filter( 'bp_is_username_compatibility_mode', '__return_false' );
    492492
    493         $u = $this->create_user( array(
     493        $u = $this->factory->user->create( array(
    494494            'user_login' => 'foo bar baz',
    495495            'user_nicename' => 'foo-bar-baz',
     
    508508
    509509        // all spaces are hyphens
    510         $u1 = $this->create_user( array(
     510        $u1 = $this->factory->user->create( array(
    511511            'user_login' => 'foo bar baz',
    512512            'user_nicename' => 'foobarbaz',
     
    514514
    515515        // no spaces are hyphens
    516         $u2 = $this->create_user( array(
     516        $u2 = $this->factory->user->create( array(
    517517            'user_login' => 'foo-bar-baz-1',
    518518            'user_nicename' => 'foobarbaz-1',
     
    520520
    521521        // some spaces are hyphens
    522         $u3 = $this->create_user( array(
     522        $u3 = $this->factory->user->create( array(
    523523            'user_login' => 'foo bar-baz 2',
    524524            'user_nicename' => 'foobarbaz-2',
    525525        ) );
    526526
    527         $u4 = $this->create_user( array(
     527        $u4 = $this->factory->user->create( array(
    528528            'user_login' => 'foo.bar.baz',
    529529            'user_nicename' => 'foo-bar-baz',
     
    543543     */
    544544    public function test_bp_activity_format_activity_action_activity_update() {
    545         $u = $this->create_user();
     545        $u = $this->factory->user->create();
    546546        $a = $this->factory->activity->create( array(
    547547            'component' => buddypress()->activity->id,
     
    562562     */
    563563    public function test_bp_activity_format_activity_action_activity_comment() {
    564         $u = $this->create_user();
     564        $u = $this->factory->user->create();
    565565        $a = $this->factory->activity->create( array(
    566566            'component' => buddypress()->activity->id,
     
    747747     */
    748748    public function test_add_user_favorite_already_favorited() {
    749         $u = $this->create_user();
     749        $u = $this->factory->user->create();
    750750        $a = $this->factory->activity->create();
    751751
     
    762762     */
    763763    public function test_add_user_favorite_not_yet_favorited() {
    764         $u = $this->create_user();
     764        $u = $this->factory->user->create();
    765765        $a = $this->factory->activity->create();
    766766        $this->assertTrue( bp_activity_add_user_favorite( $a, $u ) );
     
    772772     */
    773773    public function test_remove_user_favorite_bad_activity_id() {
    774         $u1 = $this->create_user();
    775         $u2 = $this->create_user();
     774        $u1 = $this->factory->user->create();
     775        $u2 = $this->factory->user->create();
    776776        $a = $this->factory->activity->create();
    777777
     
    805805     */
    806806    public function test_bp_activity_post_update_success() {
    807         $u = $this->create_user();
     807        $u = $this->factory->user->create();
    808808
    809809        $a = bp_activity_post_update( array(
  • trunk/tests/phpunit/testcases/activity/notifications.php

    r9061 r9139  
    1515        parent::setUp();
    1616        $this->current_user = get_current_user_id();
    17         $this->u1 = $this->create_user();
    18         $this->u2 = $this->create_user();
     17        $this->u1 = $this->factory->user->create();
     18        $this->u2 = $this->factory->user->create();
    1919        $this->set_current_user( $this->u1 );
    2020    }
  • trunk/tests/phpunit/testcases/activity/template.php

    r9043 r9139  
    6464        // save the current user and override logged-in user
    6565        $old_user = get_current_user_id();
    66         $u = $this->create_user();
     66        $u = $this->factory->user->create();
    6767        $this->set_current_user( $u );
    6868
  • trunk/tests/phpunit/testcases/admin/functions.php

    r8958 r9139  
    99        parent::setUp();
    1010        $this->old_current_user = get_current_user_id();
    11         $this->set_current_user( $this->create_user( array( 'role' => 'administrator' ) ) );
     11        $this->set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
    1212
    1313        if ( ! function_exists( 'bp_admin' ) ) {
  • trunk/tests/phpunit/testcases/blogs/activity.php

    r8958 r9139  
    1212
    1313        $b = $this->factory->blog->create();
    14         $u = $this->create_user();
     14        $u = $this->factory->user->create();
    1515        $a = $this->factory->activity->create( array(
    1616            'component' => buddypress()->blogs->id,
     
    3636        }
    3737
    38         $u = $this->create_user();
     38        $u = $this->factory->user->create();
    3939        $p = $this->factory->post->create( array(
    4040            'post_author' => $u,
     
    7070        }
    7171
    72         $u = $this->create_user();
     72        $u = $this->factory->user->create();
    7373        $p = $this->factory->post->create( array(
    7474            'post_author' => $u,
     
    105105
    106106        $b = $this->factory->blog->create();
    107         $u = $this->create_user();
     107        $u = $this->factory->user->create();
    108108
    109109        switch_to_blog( $b );
     
    145145
    146146        $b = $this->factory->blog->create();
    147         $u = $this->create_user();
     147        $u = $this->factory->user->create();
    148148
    149149        switch_to_blog( $b );
     
    190190
    191191        $b = $this->factory->blog->create();
    192         $u = $this->create_user();
     192        $u = $this->factory->user->create();
    193193
    194194        $recorded_blog          = new BP_Blogs_Blog;
     
    223223        restore_current_blog();
    224224
    225         $u = $this->create_user();
     225        $u = $this->factory->user->create();
    226226        $a = $this->factory->activity->create( array(
    227227            'component' => buddypress()->blogs->id,
     
    254254        restore_current_blog();
    255255
    256         $u = $this->create_user();
     256        $u = $this->factory->user->create();
    257257        $a = $this->factory->activity->create( array(
    258258            'component' => buddypress()->blogs->id,
  • trunk/tests/phpunit/testcases/blogs/cache.php

    r8958 r9139  
    9595        }
    9696
    97         $u = $this->create_user();
     97        $u = $this->factory->user->create();
    9898
    9999        // Switch user so we have access to non-public blogs
     
    189189        }
    190190
    191         $u = $this->create_user();
     191        $u = $this->factory->user->create();
    192192
    193193        // Switch user so we have access to non-public blogs
  • trunk/tests/phpunit/testcases/blogs/class-bp-blogs-blog.php

    r8958 r9139  
    2121        $old_user = get_current_user_id();
    2222
    23         $u = $this->create_user();
     23        $u = $this->factory->user->create();
    2424        $this->set_current_user( $u );
    2525        $b = $this->factory->blog->create( array(
     
    4747        $old_user = get_current_user_id();
    4848
    49         $u = $this->create_user();
     49        $u = $this->factory->user->create();
    5050        $this->set_current_user( $u );
    5151        $b = $this->factory->blog->create( array(
     
    7777        $old_user = get_current_user_id();
    7878
    79         $u = $this->create_user();
     79        $u = $this->factory->user->create();
    8080        $this->set_current_user( $u );
    8181        $b = $this->factory->blog->create( array(
  • trunk/tests/phpunit/testcases/blogs/functions.php

    r8958 r9139  
    401401        // save the current user and override logged-in user
    402402        $old_user = get_current_user_id();
    403         $u = $this->create_user();
     403        $u = $this->factory->user->create();
    404404        $this->set_current_user( $u );
    405405        $userdata = get_userdata( $u );
  • trunk/tests/phpunit/testcases/core/avatars.php

    r9125 r9139  
    9292        $this->clean_existing_avatars();
    9393
    94         $u = $this->create_user();
     94        $u = $this->factory->user->create();
    9595        $this->assertFalse( bp_get_user_has_avatar( $u ) );
    9696    }
     
    100100     */
    101101    public function test_bp_get_user_has_avatar_has_avatar_uploaded() {
    102         $u = $this->create_user();
     102        $u = $this->factory->user->create();
    103103
    104104        // Fake it
  • trunk/tests/phpunit/testcases/core/class-bp-button.php

    r8958 r9139  
    2222     */
    2323    public function test_block_self_own_profile() {
    24         $u = $this->create_user();
     24        $u = $this->factory->user->create();
    2525        $this->set_current_user( $u );
    2626
     
    4040     */
    4141    public function test_block_self_others_profile() {
    42         $u1 = $this->create_user();
     42        $u1 = $this->factory->user->create();
    4343        $this->set_current_user( $u1 );
    4444
    45         $u2 = $this->create_user();
     45        $u2 = $this->factory->user->create();
    4646        $this->go_to( bp_core_get_user_domain( $u2 ) );
    4747
     
    6060    public function test_block_self_inside_members_loop() {
    6161        $now = time();
    62         $u1 = $this->create_user( array(
     62        $u1 = $this->factory->user->create( array(
    6363            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    6464        ) );
    65         $u2 = $this->create_user( array(
     65        $u2 = $this->factory->user->create( array(
    6666            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    6767        ) );
     
    100100    public function test_block_self_false_inside_members_loop() {
    101101        $now = time();
    102         $u1 = $this->create_user( array(
     102        $u1 = $this->factory->user->create( array(
    103103            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    104104        ) );
    105         $u2 = $this->create_user( array(
     105        $u2 = $this->factory->user->create( array(
    106106            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    107107        ) );
     
    140140    public function test_block_self_inside_members_loop_on_my_profile_page() {
    141141        $now = time();
    142         $u1 = $this->create_user( array(
     142        $u1 = $this->factory->user->create( array(
    143143            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    144144        ) );
    145         $u2 = $this->create_user( array(
     145        $u2 = $this->factory->user->create( array(
    146146            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    147147        ) );
  • trunk/tests/phpunit/testcases/core/class-bp-core-user.php

    r8958 r9139  
    2020     */
    2121    public function test_get_users_with_exclude_querystring() {
    22         $u1 = $this->create_user();
    23         $u2 = $this->create_user();
    24         $u3 = $this->create_user();
     22        $u1 = $this->factory->user->create();
     23        $u2 = $this->factory->user->create();
     24        $u3 = $this->factory->user->create();
    2525
    2626        $exclude_qs = $u1 . ',junkstring,' . $u3;
     
    3636     */
    3737    public function test_get_users_with_exclude_array() {
    38         $u1 = $this->create_user();
    39         $u2 = $this->create_user();
    40         $u3 = $this->create_user();
     38        $u1 = $this->factory->user->create();
     39        $u2 = $this->factory->user->create();
     40        $u3 = $this->factory->user->create();
    4141
    4242        $exclude_array = array(
     
    5656     */
    5757    public function test_get_users_with_include_querystring() {
    58         $u1 = $this->create_user( array(
     58        $u1 = $this->factory->user->create( array(
    5959            'last_activity' => gmdate( 'Y-m-d H:i:s' ),
    6060        ) );
    61         $u2 = $this->create_user( array(
     61        $u2 = $this->factory->user->create( array(
    6262            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ),
    6363        ) );
    64         $u3 = $this->create_user( array(
     64        $u3 = $this->factory->user->create( array(
    6565            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ),
    6666        ) );
     
    7878     */
    7979    public function test_get_users_with_include_array() {
    80         $u1 = $this->create_user( array(
     80        $u1 = $this->factory->user->create( array(
    8181            'last_activity' => gmdate( 'Y-m-d H:i:s' ),
    8282        ) );
    83         $u2 = $this->create_user( array(
     83        $u2 = $this->factory->user->create( array(
    8484            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ),
    8585        ) );
    86         $u3 = $this->create_user( array(
     86        $u3 = $this->factory->user->create( array(
    8787            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ),
    8888        ) );
     
    110110     */
    111111    public function test_type_alphabetical() {
    112         $u1 = $this->create_user( array(
     112        $u1 = $this->factory->user->create( array(
    113113            'display_name' => 'foo',
    114114        ) );
    115         $u2 = $this->create_user( array(
     115        $u2 = $this->factory->user->create( array(
    116116            'display_name' => 'bar',
    117117        ) );
     
    129129     */
    130130    public function test_get_users_by_letter() {
    131         $u1 = $this->create_user( array(
     131        $u1 = $this->factory->user->create( array(
    132132            'display_name' => 'foo',
    133133        ) );
    134         $u2 = $this->create_user( array(
     134        $u2 = $this->factory->user->create( array(
    135135            'display_name' => 'bar',
    136136        ) );
     
    146146     */
    147147    public function test_search_users() {
    148         $u1 = $this->create_user( array(
     148        $u1 = $this->factory->user->create( array(
    149149            'display_name' => 'foo',
    150150        ) );
    151         $u2 = $this->create_user( array(
     151        $u2 = $this->factory->user->create( array(
    152152            'display_name' => 'bar',
    153153        ) );
     
    160160
    161161    public function test_get_specific_users() {
    162         $u1 = $this->create_user();
    163         $u2 = $this->create_user();
    164         $u3 = $this->create_user();
     162        $u1 = $this->factory->user->create();
     163        $u2 = $this->factory->user->create();
     164        $u3 = $this->factory->user->create();
    165165
    166166        $include_array = array(
     
    180180     */
    181181    public function test_get_last_activity() {
    182         $u = $this->create_user();
     182        $u = $this->factory->user->create();
    183183        $time = bp_core_current_time();
    184184
     
    196196     */
    197197    public function test_get_last_activity_store_in_cache() {
    198         $u = $this->create_user();
     198        $u = $this->factory->user->create();
    199199        $time = bp_core_current_time();
    200200
     
    214214     */
    215215    public function test_get_last_activity_store_in_cache_multiple_users() {
    216         $u1 = $this->create_user();
    217         $u2 = $this->create_user();
     216        $u1 = $this->factory->user->create();
     217        $u2 = $this->factory->user->create();
    218218        $time = bp_core_current_time();
    219219
     
    235235     */
    236236    public function test_get_last_activity_from_cache_single_user() {
    237         $u    = $this->create_user();
     237        $u    = $this->factory->user->create();
    238238        $time = bp_core_current_time();
    239239
     
    258258     */
    259259    public function test_get_last_activity_in_cache_multiple_users() {
    260         $u1 = $this->create_user();
    261         $u2 = $this->create_user();
     260        $u1 = $this->factory->user->create();
     261        $u2 = $this->factory->user->create();
    262262        $time = bp_core_current_time();
    263263
     
    283283     */
    284284    public function test_update_last_activity() {
    285         $u = $this->create_user();
     285        $u = $this->factory->user->create();
    286286        $time = bp_core_current_time();
    287287        $time2 = '1968-12-25 01:23:45';
     
    302302     */
    303303    public function test_delete_last_activity() {
    304         $u = $this->create_user();
     304        $u = $this->factory->user->create();
    305305        $time = bp_core_current_time();
    306306
  • trunk/tests/phpunit/testcases/core/class-bp-user-query.php

    r9051 r9139  
    2424     */
    2525    public function test_bp_user_query_friends() {
    26         $u1 = $this->create_user();
    27         $u2 = $this->create_user();
    28         $u3 = $this->create_user();
     26        $u1 = $this->factory->user->create();
     27        $u2 = $this->factory->user->create();
     28        $u3 = $this->factory->user->create();
    2929        friends_add_friend( $u1, $u2, true );
    3030
     
    4242     */
    4343    public function test_bp_user_query_friends_with_include() {
    44         $u1 = $this->create_user();
    45         $u2 = $this->create_user();
    46         $u3 = $this->create_user();
    47         $u4 = $this->create_user();
     44        $u1 = $this->factory->user->create();
     45        $u2 = $this->factory->user->create();
     46        $u3 = $this->factory->user->create();
     47        $u4 = $this->factory->user->create();
    4848        friends_add_friend( $u1, $u2, true );
    4949        friends_add_friend( $u1, $u3, true );
     
    6363
    6464    public function test_bp_user_query_friends_with_include_but_zero_friends() {
    65         $u1 = $this->create_user();
    66         $u2 = $this->create_user();
    67         $u3 = $this->create_user();
    68         $u4 = $this->create_user();
     65        $u1 = $this->factory->user->create();
     66        $u2 = $this->factory->user->create();
     67        $u3 = $this->factory->user->create();
     68        $u4 = $this->factory->user->create();
    6969
    7070        $q = new BP_User_Query( array(
     
    8282
    8383    public function test_bp_user_query_sort_by_popular() {
    84         $u1 = $this->create_user();
    85         $u2 = $this->create_user();
    86         $u3 = $this->create_user();
    87         $u4 = $this->create_user();
     84        $u1 = $this->factory->user->create();
     85        $u2 = $this->factory->user->create();
     86        $u3 = $this->factory->user->create();
     87        $u4 = $this->factory->user->create();
    8888
    8989        bp_update_user_meta( $u1, bp_get_user_meta_key( 'total_friend_count' ), '5' );
     
    108108    public function test_bp_user_query_type_online() {
    109109        $now = time();
    110         $u1 = $this->create_user( array(
     110        $u1 = $this->factory->user->create( array(
    111111            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    112112        ) );
    113         $u2 = $this->create_user( array(
     113        $u2 = $this->factory->user->create( array(
    114114            'last_activity' => date( 'Y-m-d H:i:s', $now - 60*13 ),
    115115        ) );
    116         $u3 = $this->create_user( array(
     116        $u3 = $this->factory->user->create( array(
    117117            'last_activity' => date( 'Y-m-d H:i:s', $now - 60*16 ),
    118118        ) );
     
    132132    public function test_bp_user_query_type_online_five_minute_interval() {
    133133        $now = time();
    134         $u1 = $this->create_user( array(
     134        $u1 = $this->factory->user->create( array(
    135135            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    136136        ) );
    137         $u2 = $this->create_user( array(
     137        $u2 = $this->factory->user->create( array(
    138138            'last_activity' => date( 'Y-m-d H:i:s', $now - 60*4 ),
    139139        ) );
    140         $u3 = $this->create_user( array(
     140        $u3 = $this->factory->user->create( array(
    141141            'last_activity' => date( 'Y-m-d H:i:s', $now - 60*6 ),
    142142        ) );
     
    156156    public function test_bp_user_query_search_with_apostrophe() {
    157157        // Apostrophe. Search_terms must escaped to mimic POST payload
    158         $user_id = $this->create_user();
     158        $user_id = $this->factory->user->create();
    159159        xprofile_set_field_data( 1, $user_id, "Foo'Bar" );
    160160        $q = new BP_User_Query( array( 'search_terms' => "oo\'Ba", ) );
     
    172172
    173173        // LIKE special character: %
    174         $user_id = $this->create_user();
     174        $user_id = $this->factory->user->create();
    175175        xprofile_set_field_data( 1, $user_id, "Foo%Bar" );
    176176        $q = new BP_User_Query( array( 'search_terms' => "oo%Bar", ) );
     
    189189
    190190        // LIKE special character: _
    191         $user_id = $this->create_user();
     191        $user_id = $this->factory->user->create();
    192192        xprofile_set_field_data( 1, $user_id, "Foo_Bar" );
    193193        $q = new BP_User_Query( array( 'search_terms' => "oo_Bar", ) );
     
    205205
    206206        // LIKE special character: &
    207         $user_id = $this->create_user();
     207        $user_id = $this->factory->user->create();
    208208        xprofile_set_field_data( 1, $user_id, "a&mpersand" );
    209209        $q = new BP_User_Query( array( 'search_terms' => "a&m", ) );
     
    223223     */
    224224    public function test_bp_user_query_search_core_fields() {
    225         $user_id = $this->create_user( array(
     225        $user_id = $this->factory->user->create( array(
    226226            'user_login' => 'foo',
    227227        ) );
     
    239239
    240240    public function test_bp_user_query_search_wildcards() {
    241         $u1 = $this->create_user( array(
     241        $u1 = $this->factory->user->create( array(
    242242            'user_login' => 'xfoo',
    243243        ) );
     
    245245        $q1 = new BP_User_Query( array( 'search_terms' => 'foo', 'search_wildcard' => 'left' ) );
    246246
    247         $u2 = $this->create_user( array(
     247        $u2 = $this->factory->user->create( array(
    248248            'user_login' => 'foox',
    249249        ) );
     
    251251        $q2 = new BP_User_Query( array( 'search_terms' => 'foo', 'search_wildcard' => 'right' ) );
    252252
    253         $u3 = $this->create_user( array(
     253        $u3 = $this->factory->user->create( array(
    254254            'user_login' => 'xfoox',
    255255        ) );
     
    279279        $existing_users = $wpdb->get_col( "SELECT ID FROM {$wpdb->users}" );
    280280
    281         $u1 = $this->create_user();
    282         $u2 = $this->create_user();
     281        $u1 = $this->factory->user->create();
     282        $u2 = $this->factory->user->create();
    283283
    284284        $exclude = array_merge( array( $u1 ), $existing_users );
     
    307307        add_filter( 'bp_disable_profile_sync', '__return_false' );
    308308
    309         $u1 = $this->create_user();
    310         $u2 = $this->create_user();
     309        $u1 = $this->factory->user->create();
     310        $u2 = $this->factory->user->create();
    311311
    312312        global $wpdb;
     
    338338     */
    339339    public function test_bp_user_query_type_alphabetical_spam_xprofileoff() {
    340         $u1 = $this->create_user();
    341         $u2 = $this->create_user();
     340        $u1 = $this->factory->user->create();
     341        $u2 = $this->factory->user->create();
    342342
    343343        // Make sure xprofile and profile sync are off
     
    373373     */
    374374    public function test_bp_user_query_with_user_meta_argument() {
    375         $u1 = $this->create_user();
    376         $u2 = $this->create_user();
     375        $u1 = $this->factory->user->create();
     376        $u2 = $this->factory->user->create();
    377377
    378378        bp_update_user_meta( $u2, 'foo', 'bar' );
     
    395395     */
    396396    public function test_bp_user_query_with_user_meta_argument_no_user() {
    397         $u1 = $this->create_user();
    398         $u2 = $this->create_user();
     397        $u1 = $this->factory->user->create();
     398        $u2 = $this->factory->user->create();
    399399
    400400        $q = new BP_User_Query( array(
  • trunk/tests/phpunit/testcases/core/nav.php

    r8958 r9139  
    198198     */
    199199    public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_my_profile() {
    200         $u = $this->create_user();
     200        $u = $this->factory->user->create();
    201201        $old_current_user = get_current_user_id();
    202202        $this->set_current_user( $u );
     
    220220     */
    221221    public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_others_profile_default_component_accessible() {
    222         $u1 = $this->create_user();
    223         $u2 = $this->create_user();
     222        $u1 = $this->factory->user->create();
     223        $u2 = $this->factory->user->create();
    224224        $old_current_user = get_current_user_id();
    225225        $this->set_current_user( $u1 );
     
    255255     */
    256256    public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_others_profile_default_component_not_accessible() {
    257         $u1 = $this->create_user();
    258         $u2 = $this->create_user();
     257        $u1 = $this->factory->user->create();
     258        $u2 = $this->factory->user->create();
    259259        $old_current_user = get_current_user_id();
    260260        $this->set_current_user( $u1 );
     
    290290     */
    291291    public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_group() {
    292         $u = $this->create_user();
     292        $u = $this->factory->user->create();
    293293        $g = $this->factory->group->create();
    294294        $old_current_user = get_current_user_id();
     
    319319     */
    320320    public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_group_no_redirect_url_provided() {
    321         $u = $this->create_user();
     321        $u = $this->factory->user->create();
    322322        $g = $this->factory->group->create();
    323323        $old_current_user = get_current_user_id();
  • trunk/tests/phpunit/testcases/friends/activity.php

    r8958 r9139  
    1111     */
    1212    public function test_bp_friends_format_activity_action_friendship_accepted() {
    13         $u1 = $this->create_user();
    14         $u2 = $this->create_user();
     13        $u1 = $this->factory->user->create();
     14        $u2 = $this->factory->user->create();
    1515
    1616        $a = $this->factory->activity->create( array(
     
    3333     */
    3434    public function test_bp_friends_format_activity_action_friendship_created() {
    35         $u1 = $this->create_user();
    36         $u2 = $this->create_user();
     35        $u1 = $this->factory->user->create();
     36        $u2 = $this->factory->user->create();
    3737
    3838        $a = $this->factory->activity->create( array(
  • trunk/tests/phpunit/testcases/friends/class-bp-friends-friendship.php

    r8958 r9139  
    2020
    2121    public function test_search_friends() {
    22         $u1 = $this->create_user();
    23         $u2 = $this->create_user();
    24         $u3 = $this->create_user();
     22        $u1 = $this->factory->user->create();
     23        $u2 = $this->factory->user->create();
     24        $u3 = $this->factory->user->create();
    2525
    2626        xprofile_set_field_data( 1, $u2, 'Cool Dude' );
     
    3535
    3636    public function test_get_bulk_last_active() {
    37         $u1 = $this->create_user( array(
     37        $u1 = $this->factory->user->create( array(
    3838            'last_activity' => gmdate( 'Y-m-d H:i:s' ),
    3939        ) );
    40         $u2 = $this->create_user( array(
     40        $u2 = $this->factory->user->create( array(
    4141            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ),
    4242        ) );
    43         $u3 = $this->create_user( array(
     43        $u3 = $this->factory->user->create( array(
    4444            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ),
    4545        ) );
     
    5151
    5252    public function test_search_users() {
    53         $u1 = $this->create_user();
    54         $u2 = $this->create_user();
    55         $u3 = $this->create_user();
     53        $u1 = $this->factory->user->create();
     54        $u2 = $this->factory->user->create();
     55        $u3 = $this->factory->user->create();
    5656
    5757        xprofile_set_field_data( 1, $u1, 'Freedom Isn\'t Free' );
     
    6565
    6666    public function test_search_users_count() {
    67         $u1 = $this->create_user();
    68         $u2 = $this->create_user();
    69         $u3 = $this->create_user();
     67        $u1 = $this->factory->user->create();
     68        $u2 = $this->factory->user->create();
     69        $u3 = $this->factory->user->create();
    7070
    7171        xprofile_set_field_data( 1, $u1, 'Freedom Isn\'t Free' );
     
    8282     */
    8383    public function test_check_is_friend_not_friends() {
    84         $u1 = $this->create_user();
    85         $u2 = $this->create_user();
     84        $u1 = $this->factory->user->create();
     85        $u2 = $this->factory->user->create();
    8686        $this->assertEquals( 'not_friends', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) );
    8787    }
     
    9191     */
    9292    public function test_check_is_friend_pending() {
    93         $u1 = $this->create_user();
    94         $u2 = $this->create_user();
     93        $u1 = $this->factory->user->create();
     94        $u2 = $this->factory->user->create();
    9595        friends_add_friend( $u1, $u2, false );
    9696        $this->assertEquals( 'pending', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) );
     
    101101     */
    102102    public function test_check_is_friend_awaiting_response() {
    103         $u1 = $this->create_user();
    104         $u2 = $this->create_user();
     103        $u1 = $this->factory->user->create();
     104        $u2 = $this->factory->user->create();
    105105        friends_add_friend( $u1, $u2, false );
    106106        $this->assertEquals( 'awaiting_response', BP_Friends_Friendship::check_is_friend( $u2, $u1 ) );
     
    111111     */
    112112    public function test_check_is_friend_is_friend() {
    113         $u1 = $this->create_user();
    114         $u2 = $this->create_user();
     113        $u1 = $this->factory->user->create();
     114        $u2 = $this->factory->user->create();
    115115        friends_add_friend( $u1, $u2, true );
    116116        $this->assertEquals( 'is_friend', BP_Friends_Friendship::check_is_friend( $u1, $u2 ) );
  • trunk/tests/phpunit/testcases/friends/functions.php

    r8958 r9139  
    1313     */
    1414    public function test_requests_on_accept() {
    15         $u1 = $this->create_user();
    16         $u2 = $this->create_user();
    17         $u3 = $this->create_user();
     15        $u1 = $this->factory->user->create();
     16        $u2 = $this->factory->user->create();
     17        $u3 = $this->factory->user->create();
    1818
    1919        // request friendship
     
    4242     */
    4343    public function test_requests_on_request() {
    44         $u1 = $this->create_user();
    45         $u2 = $this->create_user();
    46         $u3 = $this->create_user();
     44        $u1 = $this->factory->user->create();
     45        $u2 = $this->factory->user->create();
     46        $u3 = $this->factory->user->create();
    4747
    4848        // request friendship
     
    6767     */
    6868    public function test_requests_on_withdraw() {
    69         $u1 = $this->create_user();
    70         $u2 = $this->create_user();
     69        $u1 = $this->factory->user->create();
     70        $u2 = $this->factory->user->create();
    7171
    7272        // request friendship
     
    9595     */
    9696    public function test_requests_on_reject() {
    97         $u1 = $this->create_user();
    98         $u2 = $this->create_user();
     97        $u1 = $this->factory->user->create();
     98        $u2 = $this->factory->user->create();
    9999
    100100        // request friendship
     
    121121     */
    122122    public function test_friends_add_friend_fail_on_self() {
    123         $u1 = $this->create_user();
     123        $u1 = $this->factory->user->create();
    124124        $this->assertFalse( friends_add_friend( $u1, $u1 ) );
    125125    }
     
    129129     */
    130130    public function test_friends_add_friend_already_friends() {
    131         $u1 = $this->create_user();
    132         $u2 = $this->create_user();
     131        $u1 = $this->factory->user->create();
     132        $u2 = $this->factory->user->create();
    133133
    134134        friends_add_friend( $u1, $u2, true );
     
    142142    public function test_friends_check_friendship_status_in_members_loop() {
    143143        $now = time();
    144         $u1 = $this->create_user( array(
     144        $u1 = $this->factory->user->create( array(
    145145            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    146146        ) );
    147         $u2 = $this->create_user( array(
     147        $u2 = $this->factory->user->create( array(
    148148            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    149149        ) );
    150         $u3 = $this->create_user( array(
     150        $u3 = $this->factory->user->create( array(
    151151            'last_activity' => date( 'Y-m-d H:i:s', $now - 200 ),
    152152        ) );
    153         $u4 = $this->create_user( array(
     153        $u4 = $this->factory->user->create( array(
    154154            'last_activity' => date( 'Y-m-d H:i:s', $now - 300 ),
    155155        ) );
    156         $u5 = $this->create_user( array(
     156        $u5 = $this->factory->user->create( array(
    157157            'last_activity' => date( 'Y-m-d H:i:s', $now - 400 ),
    158158        ) );
     
    190190    public function test_friends_check_friendship_status_not_in_members_loop() {
    191191        $now = time();
    192         $u1 = $this->create_user( array(
     192        $u1 = $this->factory->user->create( array(
    193193            'last_activity' => date( 'Y-m-d H:i:s', $now ),
    194194        ) );
    195         $u2 = $this->create_user( array(
     195        $u2 = $this->factory->user->create( array(
    196196            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    197197        ) );
    198         $u3 = $this->create_user( array(
     198        $u3 = $this->factory->user->create( array(
    199199            'last_activity' => date( 'Y-m-d H:i:s', $now - 200 ),
    200200        ) );
    201         $u4 = $this->create_user( array(
     201        $u4 = $this->factory->user->create( array(
    202202            'last_activity' => date( 'Y-m-d H:i:s', $now - 300 ),
    203203        ) );
    204         $u5 = $this->create_user( array(
     204        $u5 = $this->factory->user->create( array(
    205205            'last_activity' => date( 'Y-m-d H:i:s', $now - 400 ),
    206206        ) );
  • trunk/tests/phpunit/testcases/groups/activity.php

    r8958 r9139  
    1111     */
    1212    public function test_bp_groups_format_activity_action_created_group() {
    13         $u = $this->create_user();
     13        $u = $this->factory->user->create();
    1414        $g = $this->factory->group->create();
    1515        $a = $this->factory->activity->create( array(
     
    3333     */
    3434    public function test_bp_groups_format_activity_action_joined_group() {
    35         $u = $this->create_user();
     35        $u = $this->factory->user->create();
    3636        $g = $this->factory->group->create();
    3737        $a = $this->factory->activity->create( array(
  • trunk/tests/phpunit/testcases/groups/cache.php

    r8958 r9139  
    160160     */
    161161    public function test_groups_get_group_admins_cache() {
    162         $u1 = $this->create_user();
    163         $u2 = $this->create_user();
     162        $u1 = $this->factory->user->create();
     163        $u2 = $this->factory->user->create();
    164164        $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    165165
     
    182182     */
    183183    public function test_groups_get_group_admins_cache_on_member_save() {
    184         $u1 = $this->create_user();
    185         $u2 = $this->create_user();
     184        $u1 = $this->factory->user->create();
     185        $u2 = $this->factory->user->create();
    186186        $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    187187
  • trunk/tests/phpunit/testcases/groups/class-bp-group-extension.php

    r8958 r9139  
    293293
    294294        // Test as group member
    295         $u = $this->create_user();
     295        $u = $this->factory->user->create();
    296296        $this->set_current_user( $u );
    297297        $this->add_user_to_group( $u, $g );
     
    336336
    337337        // Test as group member
    338         $u = $this->create_user();
     338        $u = $this->factory->user->create();
    339339        $this->set_current_user( $u );
    340340        $this->add_user_to_group( $u, $g );
     
    422422        $g_obj = groups_get_group( array( 'group_id' => $g ) );
    423423
    424         $u = $this->create_user();
     424        $u = $this->factory->user->create();
    425425        $old_current_user = get_current_user_id();
    426426        $this->set_current_user( $u );
     
    464464        $g_obj = groups_get_group( array( 'group_id' => $g ) );
    465465
    466         $u = $this->create_user();
     466        $u = $this->factory->user->create();
    467467        $old_current_user = get_current_user_id();
    468468        $this->set_current_user( $u );
     
    508508        $g_obj = groups_get_group( array( 'group_id' => $g ) );
    509509
    510         $u = $this->create_user();
     510        $u = $this->factory->user->create();
    511511        $old_current_user = get_current_user_id();
    512512        $this->set_current_user( $u );
     
    554554        $g_obj = groups_get_group( array( 'group_id' => $g ) );
    555555
    556         $u = $this->create_user();
     556        $u = $this->factory->user->create();
    557557        $old_current_user = get_current_user_id();
    558558        $this->set_current_user( $u );
     
    682682        $g_obj = groups_get_group( array( 'group_id' => $g ) );
    683683
    684         $u = $this->create_user();
     684        $u = $this->factory->user->create();
    685685        $old_current_user = get_current_user_id();
    686686        $this->set_current_user( $u );
     
    724724        $g_obj = groups_get_group( array( 'group_id' => $g ) );
    725725
    726         $u = $this->create_user();
     726        $u = $this->factory->user->create();
    727727        $old_current_user = get_current_user_id();
    728728        $this->set_current_user( $u );
     
    768768        $g_obj = groups_get_group( array( 'group_id' => $g ) );
    769769
    770         $u = $this->create_user();
     770        $u = $this->factory->user->create();
    771771        $old_current_user = get_current_user_id();
    772772        $this->set_current_user( $u );
     
    814814        $g_obj = groups_get_group( array( 'group_id' => $g ) );
    815815
    816         $u = $this->create_user();
     816        $u = $this->factory->user->create();
    817817        $old_current_user = get_current_user_id();
    818818        $this->set_current_user( $u );
  • trunk/tests/phpunit/testcases/groups/class-bp-group-member-query.php

    r9120 r9139  
    2222    public function test_with_include() {
    2323        $g = $this->factory->group->create();
    24         $u1 = $this->create_user();
    25         $u2 = $this->create_user();
    26         $u3 = $this->create_user();
     24        $u1 = $this->factory->user->create();
     25        $u2 = $this->factory->user->create();
     26        $u3 = $this->factory->user->create();
    2727        $time = time();
    2828
     
    4242    public function test_with_group_role_null() {
    4343        $g = $this->factory->group->create();
    44         $u1 = $this->create_user();
    45         $u2 = $this->create_user();
    46         $u3 = $this->create_user();
     44        $u1 = $this->factory->user->create();
     45        $u2 = $this->factory->user->create();
     46        $u3 = $this->factory->user->create();
    4747        $time = time();
    4848
     
    7070    public function test_with_group_role_member() {
    7171        $g = $this->factory->group->create();
    72         $u1 = $this->create_user();
    73         $u2 = $this->create_user();
    74         $u3 = $this->create_user();
     72        $u1 = $this->factory->user->create();
     73        $u2 = $this->factory->user->create();
     74        $u3 = $this->factory->user->create();
    7575        $time = time();
    7676
     
    9595    public function test_with_group_role_mod() {
    9696        $g = $this->factory->group->create();
    97         $u1 = $this->create_user();
    98         $u2 = $this->create_user();
    99         $u3 = $this->create_user();
     97        $u1 = $this->factory->user->create();
     98        $u2 = $this->factory->user->create();
     99        $u3 = $this->factory->user->create();
    100100        $time = time();
    101101
     
    119119
    120120    public function test_with_group_role_admin() {
    121         $u1 = $this->create_user();
    122         $u2 = $this->create_user();
    123         $u3 = $this->create_user();
     121        $u1 = $this->factory->user->create();
     122        $u2 = $this->factory->user->create();
     123        $u3 = $this->factory->user->create();
    124124        $g  = $this->factory->group->create( array(
    125125            'creator_id' => $u1
     
    147147    public function test_with_group_role_member_mod() {
    148148        $g = $this->factory->group->create();
    149         $u1 = $this->create_user();
    150         $u2 = $this->create_user();
    151         $u3 = $this->create_user();
     149        $u1 = $this->factory->user->create();
     150        $u2 = $this->factory->user->create();
     151        $u3 = $this->factory->user->create();
    152152        $time = time();
    153153
     
    171171
    172172    public function test_with_group_role_member_admin() {
    173         $u1 = $this->create_user();
    174         $u2 = $this->create_user();
    175         $u3 = $this->create_user();
     173        $u1 = $this->factory->user->create();
     174        $u2 = $this->factory->user->create();
     175        $u3 = $this->factory->user->create();
    176176        $g  = $this->factory->group->create( array(
    177177            'creator_id' => $u1,
     
    198198
    199199    public function test_with_group_role_mod_admin() {
    200         $u1 = $this->create_user();
    201         $u2 = $this->create_user();
    202         $u3 = $this->create_user();
     200        $u1 = $this->factory->user->create();
     201        $u2 = $this->factory->user->create();
     202        $u3 = $this->factory->user->create();
    203203        $g  = $this->factory->group->create( array(
    204204            'creator_id' => $u1,
     
    225225
    226226    public function test_with_group_role_member_mod_admin() {
    227         $u1 = $this->create_user();
    228         $u2 = $this->create_user();
    229         $u3 = $this->create_user();
     227        $u1 = $this->factory->user->create();
     228        $u2 = $this->factory->user->create();
     229        $u3 = $this->factory->user->create();
    230230        $g  = $this->factory->group->create( array(
    231231            'creator_id' => $u1,
     
    252252
    253253    public function test_with_group_role_member_mod_admin_banned() {
    254         $u1 = $this->create_user();
    255         $u2 = $this->create_user();
    256         $u3 = $this->create_user();
    257         $u4 = $this->create_user();
     254        $u1 = $this->factory->user->create();
     255        $u2 = $this->factory->user->create();
     256        $u3 = $this->factory->user->create();
     257        $u4 = $this->factory->user->create();
    258258        $g  = $this->factory->group->create( array(
    259259            'creator_id' => $u1,
     
    287287    public function test_with_group_role_banned() {
    288288        $g = $this->factory->group->create();
    289         $u1 = $this->create_user();
    290         $u2 = $this->create_user();
     289        $u1 = $this->factory->user->create();
     290        $u2 = $this->factory->user->create();
    291291        $time = time();
    292292
     
    308308    public function test_group_has_no_members_of_role_mod() {
    309309        $g = $this->factory->group->create();
    310         $u1 = $this->create_user();
     310        $u1 = $this->factory->user->create();
    311311        $time = time();
    312312
     
    324324    public function test_confirmed_members() {
    325325        $g = $this->factory->group->create();
    326         $u1 = $this->create_user();
    327         $u2 = $this->create_user();
     326        $u1 = $this->factory->user->create();
     327        $u2 = $this->factory->user->create();
    328328        $time = time();
    329329
     
    351351    public function test_get_with_type_last_joined() {
    352352        $g = $this->factory->group->create();
    353         $u1 = $this->create_user();
    354         $u2 = $this->create_user();
     353        $u1 = $this->factory->user->create();
     354        $u2 = $this->factory->user->create();
    355355        $time = time();
    356356
     
    377377    public function test_get_with_type_first_joined() {
    378378        $g = $this->factory->group->create();
    379         $u1 = $this->create_user();
    380         $u2 = $this->create_user();
     379        $u1 = $this->factory->user->create();
     380        $u2 = $this->factory->user->create();
    381381        $time = time();
    382382
     
    404404    public function test_get_with_type_group_activity_with_activity_component_disabled() {
    405405        $g = $this->factory->group->create();
    406         $u1 = $this->create_user();
    407         $u2 = $this->create_user();
    408         $u3 = $this->create_user();
     406        $u1 = $this->factory->user->create();
     407        $u2 = $this->factory->user->create();
     408        $u3 = $this->factory->user->create();
    409409        $c = buddypress()->groups->id;
    410410        $time = time();
     
    475475    public function test_get_with_type_group_activity() {
    476476        $g = $this->factory->group->create();
    477         $u1 = $this->create_user();
    478         $u2 = $this->create_user();
    479         $u3 = $this->create_user();
     477        $u1 = $this->factory->user->create();
     478        $u2 = $this->factory->user->create();
     479        $u3 = $this->factory->user->create();
    480480        $c = buddypress()->groups->id;
    481481        $time = time();
     
    532532    public function test_get_with_type_group_activity_no_dupes() {
    533533        $g = $this->factory->group->create();
    534         $u1 = $this->create_user();
     534        $u1 = $this->factory->user->create();
    535535        $c = buddypress()->groups->id;
    536536        $time = time();
     
    569569    public function test_get_with_type_alphabetical() {
    570570        $g = $this->factory->group->create();
    571         $u1 = $this->create_user( array(
     571        $u1 = $this->factory->user->create( array(
    572572            'display_name' => 'AAA',
    573573        ) );
    574         $u2 = $this->create_user( array(
     574        $u2 = $this->factory->user->create( array(
    575575            'display_name' => 'CCC',
    576576        ) );
    577         $u3 = $this->create_user( array(
     577        $u3 = $this->factory->user->create( array(
    578578            'display_name' => 'BBB',
    579579        ) );
     
    606606    public function test_with_invite_sent_true() {
    607607        $g = $this->factory->group->create();
    608         $u1 = $this->create_user();
    609         $u2 = $this->create_user();
     608        $u1 = $this->factory->user->create();
     609        $u2 = $this->factory->user->create();
    610610        $time = time();
    611611
     
    637637    public function test_with_invite_sent_false() {
    638638        $g = $this->factory->group->create();
    639         $u1 = $this->create_user();
    640         $u2 = $this->create_user();
     639        $u1 = $this->factory->user->create();
     640        $u2 = $this->factory->user->create();
    641641        $time = time();
    642642
     
    668668    public function test_with_inviter_id_false() {
    669669        $g = $this->factory->group->create();
    670         $u1 = $this->create_user();
    671         $u2 = $this->create_user();
     670        $u1 = $this->factory->user->create();
     671        $u2 = $this->factory->user->create();
    672672        $time = time();
    673673
     
    696696    public function test_with_inviter_id_specific() {
    697697        $g = $this->factory->group->create();
    698         $u1 = $this->create_user();
    699         $u2 = $this->create_user();
    700         $u3 = $this->create_user();
    701         $u4 = $this->create_user();
     698        $u1 = $this->factory->user->create();
     699        $u2 = $this->factory->user->create();
     700        $u3 = $this->factory->user->create();
     701        $u4 = $this->factory->user->create();
    702702        $time = time();
    703703
     
    736736    public function test_with_inviter_id_any() {
    737737        $g = $this->factory->group->create();
    738         $u1 = $this->create_user();
    739         $u2 = $this->create_user();
    740         $u3 = $this->create_user();
    741         $u4 = $this->create_user();
     738        $u1 = $this->factory->user->create();
     739        $u2 = $this->factory->user->create();
     740        $u3 = $this->factory->user->create();
     741        $u4 = $this->factory->user->create();
    742742        $time = time();
    743743
  • trunk/tests/phpunit/testcases/groups/class-bp-groups-group.php

    r9107 r9139  
    903903     */
    904904    public function test_get_group_extras_non_member() {
    905         $u = $this->create_user();
     905        $u = $this->factory->user->create();
    906906        $g = $this->factory->group->create();
    907907
     
    934934     */
    935935    public function test_get_group_extras_member() {
    936         $u = $this->create_user();
     936        $u = $this->factory->user->create();
    937937        $g = $this->factory->group->create();
    938938        $this->add_user_to_group( $u, $g );
     
    966966     */
    967967    public function test_get_group_extras_invited() {
    968         $u = $this->create_user();
     968        $u = $this->factory->user->create();
    969969        $g = $this->factory->group->create();
    970970
     
    10051005     */
    10061006    public function test_get_group_extras_pending() {
    1007         $u = $this->create_user();
     1007        $u = $this->factory->user->create();
    10081008        $g = $this->factory->group->create();
    10091009
     
    10441044     */
    10451045    public function test_get_group_extras_banned() {
    1046         $u = $this->create_user();
     1046        $u = $this->factory->user->create();
    10471047        $g = $this->factory->group->create();
    10481048
  • trunk/tests/phpunit/testcases/groups/class-bp-groups-member.php

    r8958 r9139  
    117117        $g1 = $this->factory->group->create();
    118118
    119         $u1 = $this->create_user();
    120         $u2 = $this->create_user();
     119        $u1 = $this->factory->user->create();
     120        $u2 = $this->factory->user->create();
    121121        self::add_user_to_group( $u1, $g1 );
    122122        self::add_user_to_group( $u2, $g1 );
  • trunk/tests/phpunit/testcases/groups/functions.php

    r9137 r9139  
    1919
    2020    public function test_creating_new_group_as_authenticated_user() {
    21         $u = $this->create_user();
     21        $u = $this->factory->user->create();
    2222        wp_set_current_user( $u );
    2323
     
    3030     */
    3131    public function test_total_group_count_groups_join_group() {
    32         $u1 = $this->create_user();
    33         $u2 = $this->create_user();
     32        $u1 = $this->factory->user->create();
     33        $u2 = $this->factory->user->create();
    3434        $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    3535
     
    4343     */
    4444    public function test_total_group_count_groups_leave_group() {
    45         $u1 = $this->create_user();
    46         $u2 = $this->create_user();
     45        $u1 = $this->factory->user->create();
     46        $u2 = $this->factory->user->create();
    4747        $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    4848        $g2 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
     
    5959     */
    6060    public function test_total_group_count_groups_ban_member() {
    61         $u1 = $this->create_user();
    62         $u2 = $this->create_user();
     61        $u1 = $this->factory->user->create();
     62        $u2 = $this->factory->user->create();
    6363        $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    6464        $g2 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
     
    8080     */
    8181    public function test_total_group_count_groups_unban_member() {
    82         $u1 = $this->create_user();
    83         $u2 = $this->create_user();
     82        $u1 = $this->factory->user->create();
     83        $u2 = $this->factory->user->create();
    8484        $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    8585        $g2 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
     
    103103     */
    104104    public function test_total_group_count_groups_accept_invite() {
    105         $u1 = $this->create_user();
    106         $u2 = $this->create_user();
     105        $u1 = $this->factory->user->create();
     106        $u2 = $this->factory->user->create();
    107107        $g = $this->factory->group->create();
    108108        groups_invite_user( array(
     
    122122     */
    123123    public function test_total_group_count_groups_accept_membership_request() {
    124         $u = $this->create_user();
     124        $u = $this->factory->user->create();
    125125        $g = $this->factory->group->create();
    126126        groups_send_membership_request( $u, $g );
     
    136136     */
    137137    public function test_total_group_count_groups_remove_member() {
    138         $u1 = $this->create_user();
    139         $u2 = $this->create_user();
     138        $u1 = $this->factory->user->create();
     139        $u2 = $this->factory->user->create();
    140140        $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    141141        $g2 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
     
    157157     */
    158158    public function test_total_member_count_groups_join_group() {
    159         $u1 = $this->create_user();
    160         $u2 = $this->create_user();
     159        $u1 = $this->factory->user->create();
     160        $u2 = $this->factory->user->create();
    161161        $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    162162
     
    170170     */
    171171    public function test_total_member_count_groups_leave_group() {
    172         $u1 = $this->create_user();
     172        $u1 = $this->factory->user->create();
    173173        $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    174174        groups_join_group( $g1, $u1 );
     
    183183     */
    184184    public function test_total_member_count_groups_ban_member() {
    185         $u1 = $this->create_user();
    186         $u2 = $this->create_user();
     185        $u1 = $this->factory->user->create();
     186        $u2 = $this->factory->user->create();
    187187        $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    188188        groups_join_group( $g1, $u2 );
     
    202202     */
    203203    public function test_total_member_count_groups_unban_member() {
    204         $u1 = $this->create_user();
    205         $u2 = $this->create_user();
     204        $u1 = $this->factory->user->create();
     205        $u2 = $this->factory->user->create();
    206206        $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    207207        groups_join_group( $g1, $u2 );
     
    223223     */
    224224    public function test_total_member_count_groups_accept_invite() {
    225         $u1 = $this->create_user();
    226         $u2 = $this->create_user();
     225        $u1 = $this->factory->user->create();
     226        $u2 = $this->factory->user->create();
    227227        $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    228228        groups_invite_user( array(
     
    242242     */
    243243    public function test_total_member_count_groups_accept_membership_request() {
    244         $u1 = $this->create_user();
    245         $u2 = $this->create_user();
     244        $u1 = $this->factory->user->create();
     245        $u2 = $this->factory->user->create();
    246246        $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    247247
     
    257257     */
    258258    public function test_total_member_count_groups_remove_member() {
    259         $u1 = $this->create_user();
    260         $u2 = $this->create_user();
     259        $u1 = $this->factory->user->create();
     260        $u2 = $this->factory->user->create();
    261261        $g1 = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    262262        groups_join_group( $g1, $u2 );
     
    276276     */
    277277    public function test_total_member_count_groups_create_group() {
    278         $u1 = $this->create_user();
     278        $u1 = $this->factory->user->create();
    279279        $g = groups_create_group( array(
    280280            'creator_id' => $u1,
     
    602602    public function test_groups_get_group_cache_different_users() {
    603603        $g = $this->factory->group->create();
    604         $u1 = $this->create_user();
    605         $u2 = $this->create_user();
     604        $u1 = $this->factory->user->create();
     605        $u2 = $this->factory->user->create();
    606606        $this->add_user_to_group( $u1, $g );
    607607
     
    624624     */
    625625    public function test_get_invite_count_for_user() {
    626         $u1 = $this->create_user();
    627         $u2 = $this->create_user();
     626        $u1 = $this->factory->user->create();
     627        $u2 = $this->factory->user->create();
    628628        $g = $this->factory->group->create( array( 'creator_id' => $u1 ) );
    629629
  • trunk/tests/phpunit/testcases/groups/template.php

    r9120 r9139  
    132132     */
    133133    public function test_bp_group_has_members_vanilla() {
    134         $u1 = $this->create_user();
    135         $u2 = $this->create_user();
     134        $u1 = $this->factory->user->create();
     135        $u2 = $this->factory->user->create();
    136136        $g  = $this->factory->group->create( array(
    137137            'creator_id' => $u1,
     
    160160     */
    161161    public function test_bp_group_has_members_backpat_retval_format() {
    162         $u1 = $this->create_user();
    163         $u2 = $this->create_user();
     162        $u1 = $this->factory->user->create();
     163        $u2 = $this->factory->user->create();
    164164        $g = $this->factory->group->create( array( 'creator_id' => $u2 ) );
    165165
     
    204204        $users = array();
    205205        for ( $i = 1; $i <= 10; $i++ ) {
    206             $users[ $i ] = $this->create_user();
     206            $users[ $i ] = $this->factory->user->create();
    207207        }
    208208
     
    242242        $users = array();
    243243        for ( $i = 1; $i <= 10; $i++ ) {
    244             $users[ $i ] = $this->create_user();
     244            $users[ $i ] = $this->factory->user->create();
    245245        }
    246246
     
    265265    public function test_bp_group_has_members_with_exclude() {
    266266        $g = $this->factory->group->create();
    267         $u1 = $this->create_user();
    268         $u2 = $this->create_user();
     267        $u1 = $this->factory->user->create();
     268        $u2 = $this->factory->user->create();
    269269
    270270        $this->add_user_to_group( $u1, $g );
     
    286286    public function test_bp_group_has_members_with_exclude_admins_mods_1() {
    287287        $g = $this->factory->group->create();
    288         $u1 = $this->create_user();
    289         $u2 = $this->create_user();
    290         $u3 = $this->create_user();
     288        $u1 = $this->factory->user->create();
     289        $u2 = $this->factory->user->create();
     290        $u3 = $this->factory->user->create();
    291291
    292292        $this->add_user_to_group( $u1, $g );
     
    313313     */
    314314    public function test_bp_group_has_members_with_exclude_admins_mods_0() {
    315         $u1 = $this->create_user();
    316         $u2 = $this->create_user();
    317         $u3 = $this->create_user();
     315        $u1 = $this->factory->user->create();
     316        $u2 = $this->factory->user->create();
     317        $u3 = $this->factory->user->create();
    318318        $g = $this->factory->group->create( array(
    319319            'creator_id' => $u1,
     
    348348    public function test_bp_group_has_members_with_exclude_banned_1() {
    349349        $g = $this->factory->group->create();
    350         $u1 = $this->create_user();
    351         $u2 = $this->create_user();
     350        $u1 = $this->factory->user->create();
     351        $u2 = $this->factory->user->create();
    352352
    353353        $this->add_user_to_group( $u1, $g );
     
    371371     */
    372372    public function test_bp_group_has_members_with_exclude_banned_0() {
    373         $u1 = $this->create_user();
    374         $u2 = $this->create_user();
    375         $u3 = $this->create_user();
     373        $u1 = $this->factory->user->create();
     374        $u2 = $this->factory->user->create();
     375        $u3 = $this->factory->user->create();
    376376
    377377        $g = $this->factory->group->create( array(
     
    409409    public function test_bp_group_has_members_default_order() {
    410410        $now = time();
    411         $u1 = $this->create_user( array(
     411        $u1 = $this->factory->user->create( array(
    412412            'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 60 ),
    413413        ) );
    414         $u2 = $this->create_user( array(
     414        $u2 = $this->factory->user->create( array(
    415415            'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 600 ),
    416416        ) );
    417         $u3 = $this->create_user( array(
     417        $u3 = $this->factory->user->create( array(
    418418            'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 6000 ),
    419419        ) );
     
    448448    public function test_bp_group_has_invites_template_structure() {
    449449        $now = time();
    450         $u1 = $this->create_user( array(
     450        $u1 = $this->factory->user->create( array(
    451451            'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 60 ),
    452452        ) );
    453         $u2 = $this->create_user( array(
     453        $u2 = $this->factory->user->create( array(
    454454            'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 600 ),
    455455        ) );
    456         $u3 = $this->create_user( array(
     456        $u3 = $this->factory->user->create( array(
    457457            'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 6000 ),
    458458        ) );
    459         $u4 = $this->create_user( array(
     459        $u4 = $this->factory->user->create( array(
    460460            'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 60000 ),
    461461        ) );
     
    528528     */
    529529    public function test_bp_group_has_invites_pagination() {
    530         $u1 = $this->create_user( array(
     530        $u1 = $this->factory->user->create( array(
    531531            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 60 ),
    532532        ) );
     
    539539        $now = time();
    540540        for ( $i = 1; $i < 15; $i++ ) {
    541             $users[ $i ] = $this->create_user( array(
     541            $users[ $i ] = $this->factory->user->create( array(
    542542                'last_activity' => gmdate( 'Y-m-d H:i:s', $now - $i ),
    543543            ) );
     
    572572    public function test_bp_group_has_membership_requests_results() {
    573573        $now = time();
    574         $u1 = $this->create_user( array(
     574        $u1 = $this->factory->user->create( array(
    575575            'last_activity' => gmdate( 'Y-m-d H:i:s', $now - 60 ),
    576576        ) );
     
    583583        $memberships = array();
    584584        for ( $i = 1; $i < 15; $i++ ) {
    585             $users[ $i ] = $this->create_user( array(
     585            $users[ $i ] = $this->factory->user->create( array(
    586586                'last_activity' => gmdate( 'Y-m-d H:i:s', $now - ( 100 - $i ) ),
    587587            ) );
     
    636636     */
    637637    public function test_bp_group_has_membership_requests_format() {
    638         $u1 = $this->create_user( array(
     638        $u1 = $this->factory->user->create( array(
    639639            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 60 ),
    640640        ) );
     
    646646        $time = time();
    647647
    648         $user = $this->create_user( array(
     648        $user = $this->factory->user->create( array(
    649649            'last_activity' => gmdate( 'Y-m-d H:i:s', $time ),
    650650        ) );
     
    705705    public function test_bp_group_is_user_banned_in_groups_loop() {
    706706        $now = time();
    707         $u1 = $this->create_user( array(
     707        $u1 = $this->factory->user->create( array(
    708708            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    709709        ) );
    710         $u2 = $this->create_user( array(
     710        $u2 = $this->factory->user->create( array(
    711711            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    712712        ) );
     
    758758    public function test_bp_group_is_user_banned_not_in_groups_loop() {
    759759        $now = time();
    760         $u1 = $this->create_user( array(
     760        $u1 = $this->factory->user->create( array(
    761761            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    762762        ) );
    763         $u2 = $this->create_user( array(
     763        $u2 = $this->factory->user->create( array(
    764764            'last_activity' => date( 'Y-m-d H:i:s', $now - 100 ),
    765765        ) );
  • trunk/tests/phpunit/testcases/members/functions.php

    r9123 r9139  
    9696     */
    9797    public function test_bp_core_get_user_displayname_translate_username() {
    98         $u = $this->create_user();
     98        $u = $this->factory->user->create();
    9999
    100100        $user = new WP_User( $u );
     
    120120        buddypress()->active_components['xprofile'] = '1';
    121121
    122         $u = $this->create_user( array(
     122        $u = $this->factory->user->create( array(
    123123            'display_name' => 'Foo',
    124124        ) );
     
    140140        buddypress()->active_components['xprofile'] = '1';
    141141
    142         $u = $this->create_user();
     142        $u = $this->factory->user->create();
    143143        xprofile_set_field_data( 1, $u, 'Foo Foo' );
    144144
     
    157157        buddypress()->active_components['xprofile'] = '1';
    158158
    159         $u = $this->create_user();
     159        $u = $this->factory->user->create();
    160160        xprofile_set_field_data( 1, $u, 'Foo Foo' );
    161161
     
    174174        buddypress()->active_components['xprofile'] = '1';
    175175
    176         $u = $this->create_user( array(
     176        $u = $this->factory->user->create( array(
    177177            'display_name' => 'Foo Foo',
    178178        ) );
     
    205205     */
    206206    public function test_bp_core_get_user_displaynames_all_uncached() {
    207         $u1 = $this->create_user();
    208         $u2 = $this->create_user();
     207        $u1 = $this->factory->user->create();
     208        $u2 = $this->factory->user->create();
    209209
    210210        xprofile_set_field_data( 1, $u1, 'Foo' );
     
    223223     */
    224224    public function test_bp_core_get_user_displaynames_one_not_in_xprofile() {
    225         $u1 = $this->create_user();
    226         $u2 = $this->create_user( array(
     225        $u1 = $this->factory->user->create();
     226        $u2 = $this->factory->user->create( array(
    227227            'display_name' => 'Bar',
    228228        ) );
     
    249249     */
    250250    public function test_bp_core_get_user_displaynames_one_in_cache() {
    251         $u1 = $this->create_user();
     251        $u1 = $this->factory->user->create();
    252252        xprofile_set_field_data( 1, $u1, 'Foo' );
    253253
     
    268268     */
    269269    public function test_bp_members_migrate_signups_standard() {
    270         $u = $this->create_user();
     270        $u = $this->factory->user->create();
    271271        $u_obj = new WP_User( $u );
    272272
     
    302302     */
    303303    public function test_bp_members_migrate_signups_activation_key_but_user_status_0() {
    304         $u = $this->create_user();
     304        $u = $this->factory->user->create();
    305305        $u_obj = new WP_User( $u );
    306306
     
    333333     */
    334334    public function test_bp_members_migrate_signups_no_activation_key_but_user_status_2() {
    335         $u = $this->create_user();
     335        $u = $this->factory->user->create();
    336336        $u_obj = new WP_User( $u );
    337337
  • trunk/tests/phpunit/testcases/members/template.php

    r9045 r9139  
    2121
    2222    public function test_bp_has_members_include_on_user_page() {
    23         $u1 = $this->create_user();
    24         $u2 = $this->create_user();
     23        $u1 = $this->factory->user->create();
     24        $u2 = $this->factory->user->create();
    2525
    2626        $this->go_to( bp_core_get_user_domain( $u1 ) );
     
    4646     */
    4747    public function test_bp_has_members_search_pagination_with_spaces() {
    48         $u1 = $this->create_user( array( 'display_name' => '~ tilde u1' ) );
    49         $u2 = $this->create_user( array( 'display_name' => '~ tilde u2' ) );
     48        $u1 = $this->factory->user->create( array( 'display_name' => '~ tilde u1' ) );
     49        $u2 = $this->factory->user->create( array( 'display_name' => '~ tilde u2' ) );
    5050
    5151        $template_args = array(
     
    6868
    6969    public function test_bp_has_members_friendship_requests() {
    70         $u1 = $this->create_user();
    71         $u2 = $this->create_user();
     70        $u1 = $this->factory->user->create();
     71        $u2 = $this->factory->user->create();
    7272
    7373        friends_add_friend( $u1, $u2 );
     
    9797     */
    9898    public function test_bp_has_members_friendship_requests_with_no_requests() {
    99         $u1 = $this->create_user();
    100         $u2 = $this->create_user();
     99        $u1 = $this->factory->user->create();
     100        $u2 = $this->factory->user->create();
    101101
    102102        $old_user = get_current_user_id();
  • trunk/tests/phpunit/testcases/messages/class.bp-messages-notice.php

    r8958 r9139  
    1111        parent::setUp();
    1212        $this->old_current_user = get_current_user_id();
    13         $this->set_current_user( $this->create_user( array( 'role' => 'administrator' ) ) );
     13        $this->set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
    1414    }
    1515
     
    4444        // now get the new active notice
    4545        BP_Messages_Notice::get_active();
    46        
     46
    4747        // grab the cache and make sure it equals our new notice
    4848        $cache = wp_cache_get( 'active_notice', 'bp_messages' );
  • trunk/tests/phpunit/testcases/messages/class.bp-messages-thread.php

    r8958 r9139  
    99     */
    1010    public function test_get_current_threads_for_user_with_search_terms_inbox() {
    11         $u1 = $this->create_user();
    12         $u2 = $this->create_user();
     11        $u1 = $this->factory->user->create();
     12        $u2 = $this->factory->user->create();
    1313
    1414        $t1 = $this->factory->message->create( array(
     
    3636     */
    3737    public function test_get_current_threads_for_user_with_search_terms_sentbox() {
    38         $u1 = $this->create_user();
    39         $u2 = $this->create_user();
     38        $u1 = $this->factory->user->create();
     39        $u2 = $this->factory->user->create();
    4040
    4141        $t1 = $this->factory->message->create( array(
  • trunk/tests/phpunit/testcases/messages/functions.php

    r8958 r9139  
    1111     */
    1212    public function test_get_unread_count() {
    13         $u1 = $this->create_user();
    14         $u2 = $this->create_user();
     13        $u1 = $this->factory->user->create();
     14        $u2 = $this->factory->user->create();
    1515
    1616        // send a private message
  • trunk/tests/phpunit/testcases/messages/notifications.php

    r8958 r9139  
    1111    public function test_bp_messages_message_delete_notifications() {
    1212        $current_user = get_current_user_id();
    13         $u = $this->create_user();
     13        $u = $this->factory->user->create();
    1414        $this->set_current_user( $u );
    1515
  • trunk/tests/phpunit/testcases/notifications/class-bp-notifications-notification.php

    r8958 r9139  
    99     */
    1010    public function test_get_null_component_name() {
    11         $u = $this->create_user();
     11        $u = $this->factory->user->create();
    1212        $n1 = $this->factory->notification->create( array(
    1313            'component_name' => 'groups',
     
    5353     */
    5454    public function test_get_total_count_null_component_name() {
    55         $u = $this->create_user();
     55        $u = $this->factory->user->create();
    5656        $n1 = $this->factory->notification->create( array(
    5757            'component_name' => 'groups',
     
    9595     */
    9696    public function test_get_total_count_with_component_name() {
    97         $u = $this->create_user();
     97        $u = $this->factory->user->create();
    9898        $n1 = $this->factory->notification->create( array(
    9999            'component_name' => 'groups',
     
    123123    public function test_order_by_date() {
    124124        $now = time();
    125         $u = $this->create_user();
     125        $u = $this->factory->user->create();
    126126        $n1 = $this->factory->notification->create( array(
    127127            'component_name' => 'friends',
     
    156156     */
    157157    public function test_is_new_true() {
    158         $u = $this->create_user();
     158        $u = $this->factory->user->create();
    159159        $n1 = $this->factory->notification->create( array(
    160160            'component_name' => 'friends',
     
    188188     */
    189189    public function test_is_new_false() {
    190         $u = $this->create_user();
     190        $u = $this->factory->user->create();
    191191        $n1 = $this->factory->notification->create( array(
    192192            'component_name' => 'friends',
     
    220220     */
    221221    public function test_is_new_both() {
    222         $u = $this->create_user();
     222        $u = $this->factory->user->create();
    223223        $n1 = $this->factory->notification->create( array(
    224224            'component_name' => 'friends',
     
    253253     */
    254254    public function test_get_with_search_terms() {
    255         $u = $this->create_user();
     255        $u = $this->factory->user->create();
    256256        $n1 = $this->factory->notification->create( array(
    257257            'component_name' => 'friends',
  • trunk/tests/phpunit/testcases/notifications/functions.php

    r8958 r9139  
    66class BP_Tests_Notifications_Functions extends BP_UnitTestCase {
    77    public function test_cache_invalidation_all_for_user_on_save() {
    8         $u = $this->create_user();
     8        $u = $this->factory->user->create();
    99        $n1 = $this->factory->notification->create( array(
    1010            'component_name' => 'groups',
     
    3434
    3535    public function test_cache_invalidation_all_for_user_on_delete() {
    36         $u = $this->create_user();
     36        $u = $this->factory->user->create();
    3737        $n1 = $this->factory->notification->create( array(
    3838            'component_name' => 'groups',
     
    9797     */
    9898    public function test_bp_notifications_get_unread_notification_count_cache() {
    99         $u1 = $this->create_user();
    100         $u2 = $this->create_user();
     99        $u1 = $this->factory->user->create();
     100        $u2 = $this->factory->user->create();
    101101
    102102        $n1 = $this->factory->notification->create( array(
     
    126126     */
    127127    public function test_bp_has_notifications_filtering() {
    128         $u1 = $this->create_user();
    129         $u2 = $this->create_user();
     128        $u1 = $this->factory->user->create();
     129        $u2 = $this->factory->user->create();
    130130
    131131        // create a mixture of different notifications
  • trunk/tests/phpunit/testcases/xprofile/activity.php

    r8958 r9139  
    278278     */
    279279    public function test_bp_xprofile_format_activity_action_new_avatar() {
    280         $u = $this->create_user();
     280        $u = $this->factory->user->create();
    281281        $a = $this->factory->activity->create( array(
    282282            'component' => 'profile',
     
    300300        buddypress()->active_components['xprofile'] = '1';
    301301
    302         $u = $this->create_user();
     302        $u = $this->factory->user->create();
    303303        $a = $this->factory->activity->create( array(
    304304            'component' => buddypress()->profile->id,
     
    326326        unset( buddypress()->active_components['xprofile'] );
    327327
    328         $u = $this->create_user();
     328        $u = $this->factory->user->create();
    329329        $a = $this->factory->activity->create( array(
    330330            'component' => buddypress()->profile->id,
     
    349349     */
    350350    public function test_bp_xprofile_format_activity_action_updated_profile() {
    351         $u = $this->create_user();
     351        $u = $this->factory->user->create();
    352352        $a = $this->factory->activity->create( array(
    353353            'component' => buddypress()->profile->id,
     
    364364
    365365    protected function setup_updated_profile_data() {
    366         $this->updated_profile_data['u'] = $this->create_user();
     366        $this->updated_profile_data['u'] = $this->factory->user->create();
    367367        $this->updated_profile_data['g'] = $this->factory->xprofile_group->create();
    368368        $this->updated_profile_data['f'] = $this->factory->xprofile_field->create( array(
  • trunk/tests/phpunit/testcases/xprofile/cache.php

    r8958 r9139  
    1010     */
    1111    public function test_bp_xprofile_update_meta_cache() {
    12         $u = $this->create_user();
     12        $u = $this->factory->user->create();
    1313        $g = $this->factory->xprofile_group->create();
    1414        $f = $this->factory->xprofile_field->create( array(
     
    6565     */
    6666    public function test_bp_has_profile_meta_cache() {
    67         $u = $this->create_user();
     67        $u = $this->factory->user->create();
    6868        $g = $this->factory->xprofile_group->create();
    6969        $f = $this->factory->xprofile_field->create( array(
     
    119119     */
    120120    public function test_bp_has_profile_meta_cache_update_meta_cache_false() {
    121         $u = $this->create_user();
     121        $u = $this->factory->user->create();
    122122        $g = $this->factory->xprofile_group->create();
    123123        $f = $this->factory->xprofile_field->create( array(
  • trunk/tests/phpunit/testcases/xprofile/class-bp-xprofile-group.php

    r8958 r9139  
    1010     */
    1111    public function test_fetch_visibility_level() {
    12         $u = $this->create_user();
     12        $u = $this->factory->user->create();
    1313        $g = $this->factory->xprofile_group->create();
    1414        $f = $this->factory->xprofile_field->create( array(
  • trunk/tests/phpunit/testcases/xprofile/class-bp-xprofile-profiledata.php

    r8958 r9139  
    1010     */
    1111    public function test_exists_when_doesnt_exist() {
    12         $u = $this->create_user();
     12        $u = $this->factory->user->create();
    1313        $g = $this->factory->xprofile_group->create();
    1414        $f = $this->factory->xprofile_field->create( array(
     
    2626     */
    2727    public function test_exists_when_exists_uncached() {
    28         $u = $this->create_user();
     28        $u = $this->factory->user->create();
    2929        $g = $this->factory->xprofile_group->create();
    3030        $f = $this->factory->xprofile_field->create( array(
     
    4646     */
    4747    public function test_exists_when_exists_in_cache() {
    48         $u = $this->create_user();
     48        $u = $this->factory->user->create();
    4949        $g = $this->factory->xprofile_group->create();
    5050        $f = $this->factory->xprofile_field->create( array(
     
    6666     */
    6767    public function test_get_fielddataid_byid_when_doesnt_exist() {
    68         $u = $this->create_user();
     68        $u = $this->factory->user->create();
    6969        $g = $this->factory->xprofile_group->create();
    7070        $f = $this->factory->xprofile_field->create( array(
     
    8383     */
    8484    public function test_get_fielddataid_byid_when_exists_uncached() {
    85         $u = $this->create_user();
     85        $u = $this->factory->user->create();
    8686        $g = $this->factory->xprofile_group->create();
    8787        $f = $this->factory->xprofile_field->create( array(
     
    106106     */
    107107    public function test_get_fielddataid_byid_when_exists_in_cache() {
    108         $u = $this->create_user();
     108        $u = $this->factory->user->create();
    109109        $g = $this->factory->xprofile_group->create();
    110110        $f = $this->factory->xprofile_field->create( array(
     
    125125     */
    126126    public function test_get_value_byid_singleuser_uncached() {
    127         $u = $this->create_user();
     127        $u = $this->factory->user->create();
    128128        $g = $this->factory->xprofile_group->create();
    129129        $f = $this->factory->xprofile_field->create( array(
     
    150150        $time = date( 'Y-m-d H:i:s', time() - 60*60*24 );
    151151
    152         $u1 = $this->create_user();
    153         $u2 = $this->create_user();
     152        $u1 = $this->factory->user->create();
     153        $u2 = $this->factory->user->create();
    154154        $g = $this->factory->xprofile_group->create();
    155155        $f = $this->factory->xprofile_field->create( array(
     
    206206     */
    207207    public function test_get_value_byid_singleuser_cached() {
    208         $u = $this->create_user();
     208        $u = $this->factory->user->create();
    209209        $g = $this->factory->xprofile_group->create();
    210210        $f = $this->factory->xprofile_field->create( array(
     
    230230        $time = date( 'Y-m-d H:i:s', time() - 60*60*24 );
    231231
    232         $u1 = $this->create_user();
    233         $u2 = $this->create_user();
     232        $u1 = $this->factory->user->create();
     233        $u2 = $this->factory->user->create();
    234234        $g = $this->factory->xprofile_group->create();
    235235        $f = $this->factory->xprofile_field->create( array(
     
    279279     */
    280280    public function test_get_all_for_user_uncached() {
    281         $u = $this->create_user();
     281        $u = $this->factory->user->create();
    282282        $g1 = $this->factory->xprofile_group->create();
    283283        $g2 = $this->factory->xprofile_group->create();
     
    358358     */
    359359    public function test_get_all_for_user_cached() {
    360         $u = $this->create_user();
     360        $u = $this->factory->user->create();
    361361        $g1 = $this->factory->xprofile_group->create();
    362362        $g2 = $this->factory->xprofile_group->create();
  • trunk/tests/phpunit/testcases/xprofile/functions.php

    r9073 r9139  
    1515
    1616    public function test_get_hidden_field_types_for_user_loggedout() {
    17         $duser = $this->create_user();
     17        $duser = $this->factory->user->create();
    1818
    1919        $old_current_user = bp_loggedin_user_id();
     
    2626
    2727    public function test_get_hidden_field_types_for_user_loggedin() {
    28         $duser = $this->create_user();
    29         $cuser = $this->create_user();
     28        $duser = $this->factory->user->create();
     29        $cuser = $this->factory->user->create();
    3030
    3131        $old_current_user = bp_loggedin_user_id();
     
    3838
    3939    public function test_get_hidden_field_types_for_user_friends() {
    40         $duser = $this->create_user();
    41         $cuser = $this->create_user();
     40        $duser = $this->factory->user->create();
     41        $cuser = $this->factory->user->create();
    4242        friends_add_friend( $duser, $cuser, true );
    4343
     
    5151
    5252    public function test_get_hidden_field_types_for_user_admin() {
    53         $duser = $this->create_user();
    54         $cuser = $this->create_user();
     53        $duser = $this->factory->user->create();
     54        $cuser = $this->factory->user->create();
    5555        $this->grant_bp_moderate( $cuser );
    5656
     
    107107     */
    108108    public function test_bp_xprofile_get_field_visibility_level_user_set() {
    109         $u = $this->create_user();
     109        $u = $this->factory->user->create();
    110110        $g = $this->factory->xprofile_group->create();
    111111        $f = $this->factory->xprofile_field->create( array(
     
    126126     */
    127127    public function test_bp_xprofile_get_field_visibility_level_user_unset() {
    128         $u = $this->create_user();
     128        $u = $this->factory->user->create();
    129129        $g = $this->factory->xprofile_group->create();
    130130        $f = $this->factory->xprofile_field->create( array(
     
    144144     */
    145145    public function test_bp_xprofile_get_field_visibility_level_admin_override() {
    146         $u = $this->create_user();
     146        $u = $this->factory->user->create();
    147147        $g = $this->factory->xprofile_group->create();
    148148        $f = $this->factory->xprofile_field->create( array(
     
    538538     */
    539539    public function test_bp_get_member_profile_data_inside_loop() {
    540         $u = $this->create_user();
     540        $u = $this->factory->user->create();
    541541        $g = $this->factory->xprofile_group->create();
    542542        $f = $this->factory->xprofile_field->create( array(
     
    563563     */
    564564    public function test_bp_get_member_profile_data_outside_of_loop() {
    565         $u = $this->create_user();
     565        $u = $this->factory->user->create();
    566566        $g = $this->factory->xprofile_group->create();
    567567        $f = $this->factory->xprofile_field->create( array(
     
    584584     */
    585585    public function test_get_field_data_integer_zero() {
    586         $u = $this->create_user();
     586        $u = $this->factory->user->create();
    587587        $g = $this->factory->xprofile_group->create();
    588588        $f = $this->factory->xprofile_field->create( array(
Note: See TracChangeset for help on using the changeset viewer.