MDL-78498 behat: add support for private replies

This commit adds support for private replies in the
'the following forum replies exist in course' custom step.
This commit is contained in:
Simey Lameze
2023-08-01 16:08:18 +08:00
parent e24eb760ae
commit 066ea59ae5
2 changed files with 8 additions and 4 deletions
@@ -250,6 +250,11 @@ class behat_mod_forum extends behat_base {
$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);
@@ -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