Commit f1ecddd7 authored by Jake Dallimore's avatar Jake Dallimore
Browse files

Merge branch 'MDL-74864-master' of https://github.com/dpalou/moodle

parents b7a1693e 341039b1
...@@ -42,15 +42,36 @@ Feature: Posting to all groups in a separate group discussion is restricted to u ...@@ -42,15 +42,36 @@ Feature: Posting to all groups in a separate group discussion is restricted to u
And the following "activities" exist: And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode | | activity | name | intro | course | idnumber | groupmode |
| forum | Standard forum name | Standard forum description | C1 | sepgroups | 1 | | forum | Standard forum name | Standard forum description | C1 | sepgroups | 1 |
And the following "mod_forum > discussions" exist:
| forum | name | subject | message | group |
| sepgroups | Initial Disc ALL | Initial Disc ALL | Disc ALL content | All participants |
| sepgroups | Initial Disc G1 | Initial Disc G1 | Disc G1 content | G1 |
| sepgroups | Initial Disc G2 | Initial Disc G2 | Disc G2 content | G2 |
| sepgroups | Initial Disc G3 | Initial Disc G3 | Disc G3 content | G3 |
Scenario: Teacher with accessallgroups can view all groups Scenario: Teacher with accessallgroups can view all groups
Given I log in as "teacher1" Given I log in as "teacher1"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
When I follow "Standard forum name" When I follow "Standard forum name"
Then the "Separate groups" select box should contain "All participants" Then the "Separate groups" select box should contain "All participants"
Then the "Separate groups" select box should contain "Group A" And the "Separate groups" select box should contain "Group A"
Then the "Separate groups" select box should contain "Group B" And the "Separate groups" select box should contain "Group B"
Then the "Separate groups" select box should contain "Group C" And the "Separate groups" select box should contain "Group C"
And I select "All participants" from the "Separate groups" singleselect
And I should see "Initial Disc ALL"
And I should see "Initial Disc G1"
And I should see "Initial Disc G2"
And I should see "Initial Disc G2"
And I select "Group A" from the "Separate groups" singleselect
And I should see "Initial Disc ALL"
And I should see "Initial Disc G1"
But I should not see "Initial Disc G2"
And I should not see "Initial Disc G3"
And I select "Group B" from the "Separate groups" singleselect
And I should see "Initial Disc ALL"
And I should see "Initial Disc G2"
But I should not see "Initial Disc G1"
And I should not see "Initial Disc G3"
Scenario: Teacher with accessallgroups can select any group when posting Scenario: Teacher with accessallgroups can select any group when posting
Given I log in as "teacher1" Given I log in as "teacher1"
...@@ -249,14 +270,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u ...@@ -249,14 +270,7 @@ Feature: Posting to all groups in a separate group discussion is restricted to u
And I should see "Post a copy to all groups" And I should see "Post a copy to all groups"
Scenario: Students can view all participants discussions in separate groups mode Scenario: Students can view all participants discussions in separate groups mode
Given I log in as "teacher1" Given I log in as "student1"
And I am on "Course 1" course homepage
When I add a new discussion to "Standard forum name" forum with:
| Subject | Forum post to all participants |
| Message | This is the body |
| Group | All participants |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
And I follow "Standard forum name" When I follow "Standard forum name"
Then I should see "Forum post to all participants" Then I should see "Initial Disc ALL"
...@@ -33,15 +33,36 @@ Feature: Posting to all groups in a visible group discussion is restricted to us ...@@ -33,15 +33,36 @@ Feature: Posting to all groups in a visible group discussion is restricted to us
And the following "activities" exist: And the following "activities" exist:
| activity | name | intro | course | idnumber | groupmode | | activity | name | intro | course | idnumber | groupmode |
| forum | Standard forum name | Standard forum description | C1 | groups | 2 | | forum | Standard forum name | Standard forum description | C1 | groups | 2 |
And the following "mod_forum > discussions" exist:
| forum | name | subject | message | group |
| groups | Initial Disc ALL | Initial Disc ALL | Disc ALL content | All participants |
| groups | Initial Disc G1 | Initial Disc G1 | Disc G1 content | G1 |
| groups | Initial Disc G2 | Initial Disc G2 | Disc G2 content | G2 |
| groups | Initial Disc G3 | Initial Disc G3 | Disc G3 content | G3 |
Scenario: Teacher with accessallgroups can view all groups Scenario: Teacher with accessallgroups can view all groups
Given I log in as "teacher1" Given I log in as "teacher1"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
When I follow "Standard forum name" When I follow "Standard forum name"
Then the "Visible groups" select box should contain "All participants" Then the "Visible groups" select box should contain "All participants"
Then the "Visible groups" select box should contain "Group A" And the "Visible groups" select box should contain "Group A"
Then the "Visible groups" select box should contain "Group B" And the "Visible groups" select box should contain "Group B"
Then the "Visible groups" select box should contain "Group C" And the "Visible groups" select box should contain "Group C"
And I select "All participants" from the "Visible groups" singleselect
And I should see "Initial Disc ALL"
And I should see "Initial Disc G1"
And I should see "Initial Disc G2"
And I should see "Initial Disc G2"
And I select "Group A" from the "Visible groups" singleselect
And I should see "Initial Disc ALL"
And I should see "Initial Disc G1"
But I should not see "Initial Disc G2"
And I should not see "Initial Disc G3"
And I select "Group B" from the "Visible groups" singleselect
And I should see "Initial Disc ALL"
And I should see "Initial Disc G2"
But I should not see "Initial Disc G1"
And I should not see "Initial Disc G3"
Scenario: Teacher with accessallgroups can select any group when posting Scenario: Teacher with accessallgroups can select any group when posting
Given I log in as "teacher1" Given I log in as "teacher1"
...@@ -150,9 +171,24 @@ Feature: Posting to all groups in a visible group discussion is restricted to us ...@@ -150,9 +171,24 @@ Feature: Posting to all groups in a visible group discussion is restricted to us
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
When I follow "Standard forum name" When I follow "Standard forum name"
Then the "Visible groups" select box should contain "All participants" Then the "Visible groups" select box should contain "All participants"
Then the "Visible groups" select box should contain "Group A" And the "Visible groups" select box should contain "Group A"
Then the "Visible groups" select box should contain "Group B" And the "Visible groups" select box should contain "Group B"
Then the "Visible groups" select box should contain "Group C" And the "Visible groups" select box should contain "Group C"
And I select "All participants" from the "Visible groups" singleselect
And I should see "Initial Disc ALL"
And I should see "Initial Disc G1"
And I should see "Initial Disc G2"
And I should see "Initial Disc G2"
And I select "Group A" from the "Visible groups" singleselect
And I should see "Initial Disc ALL"
And I should see "Initial Disc G1"
But I should not see "Initial Disc G2"
And I should not see "Initial Disc G3"
And I select "Group B" from the "Visible groups" singleselect
And I should see "Initial Disc ALL"
And I should see "Initial Disc G2"
But I should not see "Initial Disc G1"
And I should not see "Initial Disc G3"
Scenario: Students in one group can only post in their group Scenario: Students in one group can only post in their group
Given I log in as "student1" Given I log in as "student1"
......
...@@ -35,7 +35,7 @@ class behat_mod_forum_generator extends behat_generator_base { ...@@ -35,7 +35,7 @@ class behat_mod_forum_generator extends behat_generator_base {
'singular' => 'discussion', 'singular' => 'discussion',
'datagenerator' => 'discussion', 'datagenerator' => 'discussion',
'required' => ['forum'], 'required' => ['forum'],
'switchids' => ['forum' => 'forumid', 'user' => 'userid'], 'switchids' => ['forum' => 'forumid', 'user' => 'userid', 'group' => 'groupid'],
], ],
'posts' => [ 'posts' => [
'singular' => 'post', 'singular' => 'post',
...@@ -62,6 +62,21 @@ class behat_mod_forum_generator extends behat_generator_base { ...@@ -62,6 +62,21 @@ class behat_mod_forum_generator extends behat_generator_base {
return $id; return $id;
} }
/**
* Gets the group id from it's idnumber. It allows using 'All participants' as idnumber.
*
* @throws Exception
* @param string $idnumber
* @return int
*/
protected function get_group_id($idnumber): int {
if ($idnumber === 'All participants') {
return -1;
}
return parent::get_group_id($idnumber);
}
/** /**
* Preprocess discussion data. * Preprocess discussion data.
* *
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment