Changeset 9139 for trunk/tests/phpunit/includes/testcase.php
- Timestamp:
- 11/14/2014 02:01:18 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase.php
r9138 r9139 319 319 } 320 320 321 /**322 * When creating a new user, it's almost always necessary to have the323 * last_activity usermeta set right away, so that the user shows up in324 * directory queries. This is a shorthand wrapper for the user factory325 * create() method.326 *327 * Also set a display name328 */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 350 321 public static function add_user_to_group( $user_id, $group_id, $args = array() ) { 351 322 $r = wp_parse_args( $args, array(
Note: See TracChangeset
for help on using the changeset viewer.