Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/14/2014 02:01:18 PM (7 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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,
Note: See TracChangeset for help on using the changeset viewer.