17 $count_users =
function () {
20 'metadata_names' =>
'__faker',
25 $count_friends =
function (
$user) {
28 'relationship' =>
'friend',
29 'relationship_guid' =>
$user->guid,
30 'inverse_relationship' =>
false,
31 'metadata_names' =>
'__faker',
38 while ($count_users() < $this->limit) {
47 $exclude[] =
$user->guid;
52 if ($count_friends(
$user)) {
58 $this->
log(
"Created new friend collection for user $user->name [collection_id: $collection_id]");
61 $friends_limit = $this->faker->numberBetween(5, 10);
63 $friends_exclude = [
$user->guid];
64 while ($count_friends(
$user) < $friends_limit) {
74 $friends_exclude[] =
$friend->guid;
77 $this->
log(
"User $user->name [guid: $user->guid] friended user $friend->name [guid: $friend->guid]");
95 'metadata_names' =>
'__faker',
102 $users->setIncrementOffset(
false);
105 if ($user->delete()) {
106 $this->
log(
"Deleted user $user->guid");
108 $this->
log(
"Failed to delete user $user->guid");
getRandomUser(array $exclude=[])
Returns random fake user.
log($msg, $level= 'NOTICE')
Log a message.
add_user_to_access_collection($user_guid, $collection_id)
Adds a user to an access collection.
elgg_get_entities_from_relationship($options)
Return entities matching a given query joining against a relationship.
createUser(array $attributes=[], array $metadata=[])
Create a new faker user.
create_access_collection($name, $owner_guid=0, $site_guid=0)
Creates a new access collection.