Skip to content

Commit

Permalink
MDL-78498 behat: add support for private replies
Browse files Browse the repository at this point in the history
This commit adds support for private replies in the
'the following forum replies exist in course' custom step.
  • Loading branch information
lameze committed Aug 1, 2023
1 parent 03795be commit bcd8431
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions mod/forum/tests/behat/behat_mod_forum.php
Expand Up @@ -250,6 +250,11 @@ public function the_following_forum_replies_exist(string $coursename, TableNode
$cm = get_coursemodule_from_instance('forum', $replyinfo['forum']);
}

// Get the user id of the user to whom the reply is private.
if (!empty($replyinfo['privatereplyto'])) {
$replyinfo['privatereplyto'] = $this->get_user_id($replyinfo['privatereplyto']);
}

// Create the reply post.
$reply = $forumgenerator->create_post($replyinfo);

Expand Down
7 changes: 3 additions & 4 deletions mod/forum/tests/behat/private_replies.feature
Expand Up @@ -26,10 +26,9 @@ Feature: Forum posts can be replied to in private
And the following "mod_forum > discussions" exist:
| user | forum | name | message |
| student1 | forum | Answers to the homework | Here are the answers to last night's homework. |
And I am on the "Science 101" course page logged in as teacher1
And I reply "Answers to the homework" post from "Study discussions" forum with:
| Message | How about you and I have a meeting after class about plagiarism? |
| Reply privately | 1 |
And the following forum replies exist in course "Science 101":
| user | forum | discussion | message | privatereplyto |
| teacher1 | Study discussions | Answers to the homework |How about you and I have a meeting after class about plagiarism?| student1 |

Scenario: As a teacher I can see my own response
Given I am on the "Study discussions" "forum activity" page logged in as teacher1
Expand Down

0 comments on commit bcd8431

Please sign in to comment.