public static function createAnonymousUser($save = true) { if (isset($_REQUEST['action'])) { unset($_REQUEST['action']); } $time = mt_rand(); $userId = 'SugarUser'; $user = new User(); $user->user_name = $userId . $time; $user->user_hash = md5($userId . $time); $user->first_name = $userId; $user->last_name = $time; $user->status = 'Active'; if ($save) { $user->save(); } $user->fill_in_additional_detail_fields(); self::$_createdUsers[] = $user; return $user; }
private function createUser($id = '', $status = '') { $time = mt_rand(); $userId = 'SugarUser'; $user = new User(); $user->user_name = $userId . $time; $user->user_hash = md5($userId . $time); $user->first_name = $userId; $user->last_name = $time; if (!empty($status)) { $user->status = $status; } else { $user->status = 'Active'; } $user->default_team = '1'; //Set Default Team to Global if (!empty($id)) { $user->new_with_id = true; $user->id = $id; } $user->save(); $user->fill_in_additional_detail_fields(); return $user; }
public function testfill_in_additional_detail_fields() { $user = new User(); $user->retrieve(1); $user->fill_in_additional_detail_fields(); $this->assertEquals("Administrator", $user->full_name); }