Changeset 9120 for trunk/tests/phpunit/includes/factory.php
- Timestamp:
- 11/03/2014 06:14:06 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/factory.php
r9117 r9120 71 71 function create_object( $args ) { 72 72 if ( ! isset( $args['creator_id'] ) ) { 73 $args['creator_id'] = get_current_user_id(); 73 if ( is_user_logged_in() ) { 74 $args['creator_id'] = get_current_user_id(); 75 76 // Create a user. This is based on from BP_UnitTestCase->create_user(). 77 } else { 78 $last_activity = date( 'Y-m-d H:i:s', strtotime( bp_core_current_time() ) - 60 * 60 * 24 * 365 ); 79 $user_factory = new WP_UnitTest_Factory_For_User(); 80 $args['creator_id'] = $this->factory->user->create( array( 'role' => 'subscriber' ) ); 81 82 bp_update_user_last_activity( $args['creator_id'] , $last_activity ); 83 84 if ( bp_is_active( 'xprofile' ) ) { 85 $user = new WP_User( $args['creator_id'] ); 86 xprofile_set_field_data( 1, $args['creator_id'] , $user->display_name ); 87 } 88 } 74 89 } 75 90 … … 80 95 81 96 groups_update_groupmeta( $group_id, 'total_member_count', 1 ); 82 83 97 $last_activity = isset( $args['last_activity'] ) ? $args['last_activity'] : bp_core_current_time(); 84 98 groups_update_groupmeta( $group_id, 'last_activity', $last_activity );
Note: See TracChangeset
for help on using the changeset viewer.