Skip to content

Commit

Permalink
MDL-64993 core_message: Add self-conversations to create_user generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Amaia Anabitarte committed May 5, 2019
1 parent e688eab commit 3204dea
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/testing/generator/data_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,13 @@ public function create_user($record=null, array $options=null) {

if (!$record['deleted']) {
context_user::instance($userid);

// All new not deleted users must have a favourite self-conversation.
$selfconversation = \core_message\api::create_conversation(
\core_message\api::MESSAGE_CONVERSATION_TYPE_SELF,
[$userid]
);
\core_message\api::set_favourite_conversation($selfconversation->id, $userid);
}

$user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
Expand Down

0 comments on commit 3204dea

Please sign in to comment.