Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/14/2014 02:01:18 PM (12 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/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(
Note: See TracChangeset for help on using the changeset viewer.