Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
f1ecddd7
Commit
f1ecddd7
authored
Jun 29, 2022
by
Jake Dallimore
Browse files
Merge branch 'MDL-74864-master' of
https://github.com/dpalou/moodle
parents
b7a1693e
341039b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
mod/forum/tests/behat/separate_group_discussions.feature
View file @
f1ecddd7
...
...
@@ -42,15 +42,36 @@ Feature: Posting to all groups in a separate group discussion is restricted to u
And the following "activities" exist
:
|
activity
|
name
|
intro
|
course
|
idnumber
|
groupmode
|
|
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
Given
I log in as
"teacher1"
And
I am on
"Course 1"
course homepage
When
I follow
"Standard forum name"
Then
the
"Separate groups"
select box should contain
"All participants"
Then
the
"Separate groups"
select box should contain
"Group A"
Then
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 A"
And
the
"Separate groups"
select box should contain
"Group B"
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
Given
I log in as
"teacher1"
...
...
@@ -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"
Scenario
:
Students can view all participants discussions in separate groups mode
Given
I log in as
"teacher1"
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"
Given
I log in as
"student1"
And
I am on
"Course 1"
course homepage
And
I follow
"Standard forum name"
Then
I should see
"
Forum post to all participants
"
When
I follow
"Standard forum name"
Then
I should see
"
Initial Disc ALL
"
mod/forum/tests/behat/visible_group_discussions.feature
View file @
f1ecddd7
...
...
@@ -33,15 +33,36 @@ Feature: Posting to all groups in a visible group discussion is restricted to us
And the following "activities" exist
:
|
activity
|
name
|
intro
|
course
|
idnumber
|
groupmode
|
|
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
Given
I log in as
"teacher1"
And
I am on
"Course 1"
course homepage
When
I follow
"Standard forum name"
Then
the
"Visible groups"
select box should contain
"All participants"
Then
the
"Visible groups"
select box should contain
"Group A"
Then
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 A"
And
the
"Visible groups"
select box should contain
"Group B"
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
Given
I log in as
"teacher1"
...
...
@@ -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
When
I follow
"Standard forum name"
Then
the
"Visible groups"
select box should contain
"All participants"
Then
the
"Visible groups"
select box should contain
"Group A"
Then
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 A"
And
the
"Visible groups"
select box should contain
"Group B"
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
Given
I log in as
"student1"
...
...
mod/forum/tests/generator/behat_mod_forum_generator.php
View file @
f1ecddd7
...
...
@@ -35,7 +35,7 @@ class behat_mod_forum_generator extends behat_generator_base {
'singular'
=>
'discussion'
,
'datagenerator'
=>
'discussion'
,
'required'
=>
[
'forum'
],
'switchids'
=>
[
'forum'
=>
'forumid'
,
'user'
=>
'userid'
],
'switchids'
=>
[
'forum'
=>
'forumid'
,
'user'
=>
'userid'
,
'group'
=>
'groupid'
],
],
'posts'
=>
[
'singular'
=>
'post'
,
...
...
@@ -62,6 +62,21 @@ class behat_mod_forum_generator extends behat_generator_base {
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.
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment