Skip to content

Commit

Permalink
Merge branch 'MDL-78498-401' of https://github.com/lameze/moodle into…
Browse files Browse the repository at this point in the history
… MOODLE_401_STABLE
  • Loading branch information
junpataleta committed Aug 2, 2023
2 parents d04d701 + 33d8297 commit 1967ccc
Show file tree
Hide file tree
Showing 26 changed files with 235 additions and 271 deletions.
38 changes: 11 additions & 27 deletions admin/tool/dataprivacy/tests/behat/protecteddelete.feature
Expand Up @@ -30,6 +30,12 @@ Feature: Protected data should not be deleted
| Site purpose | PT1H | 0 |
| prot | P1D | 1 |
| unprot | P1D | 0 |
And the following "mod_forum > discussions" exist:
| user | forum | name | message |
| u1 | forump1 | Discussion subject | Test post in forump1 |
| u1 | forumu1 | Discussion subject | Test post in forumu1 |
| u1 | forump2 | Discussion subject | Test post in forump2 |
| u1 | forumu2 | Discussion subject | Test post in forumu2 |
And I set the category and purpose for the "forump1" "forum" in course "C1" to "CAT" and "prot"
And I set the category and purpose for the "forump2" "forum" in course "C2" to "CAT" and "prot"
And I set the category and purpose for the "forumu1" "forum" in course "C1" to "CAT" and "unprot"
Expand All @@ -38,47 +44,25 @@ Feature: Protected data should not be deleted

@javascripta
Scenario: Unexpired and protected data is not removed
Given I log in as "u1"
And I am on "C1" course homepage
And I add a new discussion to "forump1" forum with:
| Subject | Discussion subject |
| Message | Test post in forump1 |
And I am on "C1" course homepage
And I add a new discussion to "forumu1" forum with:
| Subject | Discussion subject |
| Message | Test post in forumu1 |
And I am on "C2" course homepage
And I add a new discussion to "forump2" forum with:
| Subject | Discussion subject |
| Message | Test post in forump2 |
And I am on "C2" course homepage
And I add a new discussion to "forumu2" forum with:
| Subject | Discussion subject |
| Message | Test post in forumu2 |
And I log out
And I log in as "admin"
Given I log in as "admin"
And I create a dataprivacy "delete" request for "u1"
And I approve a dataprivacy "delete" request for "u1"
And I run all adhoc tasks
And I navigate to "Users > Privacy and policies > Data requests" in site administration
And I should see "Deleted" in the "u1" "table_row"

And I am on "C1" course homepage
And I follow "forump1"
And I am on the "forump1" "forum activity" page
And I follow "Discussion subject"
Then I should not see "Test post in forump1"

When I am on "C1" course homepage
And I follow "forumu1"
When I am on the "forumu1" "forum activity" page
And I follow "Discussion subject"
Then I should not see "Test post in forumu1"

And I am on "C2" course homepage
And I follow "forump2"
And I am on the "forump2" "forum activity" page
And I follow "Discussion subject"
Then I should see "Test post in forump2"

When I am on "C2" course homepage
And I follow "forumu2"
When I am on the "forumu2" "forum activity" page
And I follow "Discussion subject"
Then I should not see "Test post in forumu2"
Expand Up @@ -105,29 +105,26 @@ Feature: Change number of discussions displayed
| Message | This is forum post one |
And I press "Post to forum"
And I wait to be redirected
And I am on "Course 1" course homepage
And I am on the "C1" "course editing" page logged in as teacher1

Scenario: When number of discussions is decreased fewer discussions appear
Given I navigate to "Settings" in current page administration
And I set the following fields to these values:
Given I set the following fields to these values:
| numdiscussions | 5 |
When I press "Save and display"
Then I should see "This is forum post one"
And I should see "This is forum post five"
And I should not see "This is forum post six"

Scenario: When number of discussions is decreased to less than 1 only 1 discussion should appear
Given I navigate to "Settings" in current page administration
And I set the following fields to these values:
Given I set the following fields to these values:
| numdiscussions | -1 |
When I press "Save and display"
Then I should see "This is forum post one"
And I should not see "This is forum post two"
And I should not see "This is forum post ten"

Scenario: When number of discussions is increased more discussions appear
Given I navigate to "Settings" in current page administration
And I set the following fields to these values:
Given I set the following fields to these values:
| numdiscussions | 9 |
When I press "Save and display"
Then I should see "This is forum post one"
Expand Down
Expand Up @@ -21,9 +21,9 @@ Feature: Using the forum activities which support point scale
| activity | forum |
| name | Test forum name |
| idnumber | forum1 |
And the following forum discussions exist in course "Course 1":
| user | forum | name | message |
| student1 | Test forum name | Discussion subject | Test post in forum 1 |
And the following "mod_forum > discussions" exist:
| user | forum | name | message |
| student1 | forum1 | Discussion subject | Test post in forum 1 |

@javascript
Scenario: Forum rescale grade should not be possible when users are graded
Expand Down
6 changes: 3 additions & 3 deletions lib/form/tests/behat/modgrade_validation.feature
Expand Up @@ -24,9 +24,9 @@ Feature: Using the activity grade form element
| activity | course | section | name | intro | idnumber | type | groupmode |
| assign | C1 | 1 | Test assignment name | Test assignment description | | | |
| forum | C1 | 1 | Test forum name | | forum1 | general | 0 |
And the following forum discussions exist in course "Course 1":
| user | forum | name | message |
| student1 | Test forum name | Discussion subject | Discussion message |
And the following "mod_forum > discussions" exist:
| user | forum | name | message |
| student1 | forum1 | Discussion subject | Discussion message |

@javascript
Scenario: Being able to change the grade type, scale and maximum grade when there are no grades
Expand Down
25 changes: 11 additions & 14 deletions mod/forum/report/summary/tests/behat/private_replies.feature
Expand Up @@ -23,20 +23,17 @@ Feature: Include private replies in the summary report
And the following "activities" exist:
| activity | name | course | idnumber |
| forum | forum1 | C1 | forum1 |
And the following forum discussions exist in course "Course 1":
| user | forum | name | message |
| teacher1 | forum1 | discussion1 | t1 earliest |
| teacher1 | forum1 | discussion2 | t1 between |
| student1 | forum1 | discussion3 | s1 latest |
And the following forum replies exist in course "Course 1":
| user | forum | discussion | subject | message |
| teacher1 | forum1 | discussion1 | t1 between | t1 between |
| teacher1 | forum1 | discussion2 | t1 latest | t1 latest |
| student1 | forum1 | discussion1 | s1 earliest | s1 earliest |
And I am on the "Course 1" course page logged in as teacher1
And I reply "s1 earliest" post from "discussion1" forum with:
| Message | This is a private reply |
| Reply privately | 1 |
And the following "mod_forum > discussions" exist:
| user | forum | name | message |
| teacher1 | forum1 | discussion1 | t1 earliest |
| teacher1 | forum1 | discussion2 | t1 between |
| teacher1 | forum1 | discussion3 | s1 latest |
And the following "mod_forum > posts" exist:
| user | parentsubject | subject | message | privatereplyto |
| teacher1 | discussion1 | t1 between | t1 between | |
| teacher1 | discussion2 | t1 latest | t1 latest | |
| student1 | discussion1 | s1 earliest | s1 earliest | |
| teacher1 | s1 earliest | This is a private reply | This is a private reply | 1 |

Scenario: Private replies are counted for Teacher
When I am on the forum1 "forum activity" page logged in as teacher2
Expand Down
24 changes: 14 additions & 10 deletions mod/forum/tests/behat/add_forum.feature
Expand Up @@ -17,16 +17,20 @@ Feature: Add forum activities and discussions
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | forum |
| course | C1 |
| name | Test forum name |
| type | general |
And the following forum discussions exist in course "Course 1":
| user | forum | name | message | attachments |
| teacher1 | Test forum name | Forum post 1 | this is the body | |
| student1 | Test forum name | Post with attachment | this is the body | empty.txt |
And I log in as "student1"
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
And I add a new discussion to "Test forum name" forum with:
| Subject | Forum post 1 |
| Message | This is the body |
And I am on the "Course 1" course page logged in as student1
When I add a new discussion to "Test forum name" forum with:
| Subject | Post with attachment |
| Message | This is the body |
| Attachment | lib/tests/fixtures/empty.txt |
And I reply "Forum post 1" post from "Test forum name" forum with:
| Subject | Reply with attachment |
| Message | This is the body |
Expand Down
6 changes: 2 additions & 4 deletions mod/forum/tests/behat/advanced_search.feature
Expand Up @@ -117,8 +117,7 @@ Feature: The forum search allows users to perform advanced searches for forum po
@javascript
Scenario: Perform an advanced search on starred discussions without text
Given I am on the "Announcements" "forum activity" page logged in as student1
And I click on "Your subjective" action menu
And I follow "Star this discussion"
And I click on "Star this discussion" "link" in the "Your subjective" "table_row"
And I press "Search"
And I should see "Please enter search terms into one or more of the following fields"
And I set the field "starredonly" to "1"
Expand All @@ -129,8 +128,7 @@ Feature: The forum search allows users to perform advanced searches for forum po
@javascript
Scenario: Perform an advanced search on starred discussions with text
Given I am on the "Announcements" "forum activity" page logged in as student1
And I click on "Your subjective" action menu
And I follow "Star this discussion"
And I click on "Star this discussion" "link" in the "Your subjective" "table_row"
And I press "Search"
And I should see "Please enter search terms into one or more of the following fields"
And I set the field "words" to "message"
Expand Down
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
17 changes: 9 additions & 8 deletions mod/forum/tests/behat/discussion_lock.feature
Expand Up @@ -15,14 +15,15 @@ Feature: As a teacher, you can manually lock individual discussions when viewing
| course | C1 |
| activity | forum |
| name | Test forum name |
And the following forum discussions exist in course "Course 1":
| user | forum | name | message |
| admin | Test forum name | Discussion 1 | Discussion contents 1, first message |
| admin | Test forum name | Discussion 2 | Discussion contents 2, first message |
And the following forum replies exist in course "Course 1":
| user | forum | discussion | subject | message |
| admin | Test forum name | Discussion 1 | Reply 1 to discussion 1 | Discussion contents 1, second message |
| admin | Test forum name | Discussion 2 | Reply 1 to discussion 2 | Discussion contents 2, second message |
| idnumber | forum1 |
And the following "mod_forum > discussions" exist:
| user | forum | name | message |
| admin | forum1 | Discussion 1 | Discussion contents 1, first message |
| admin | forum1 | Discussion 2 | Discussion contents 2, first message |
And the following "mod_forum > posts" exist:
| user | parentsubject | subject | message |
| admin | Discussion 1 | Reply 1 to discussion 1 | Discussion contents 1, second message |
| admin | Discussion 2 | Reply 1 to discussion 2 | Discussion contents 2, second message |

Scenario: Lock a discussion and view
Given I am on the "Course 1" course page logged in as admin
Expand Down
55 changes: 26 additions & 29 deletions mod/forum/tests/behat/discussion_navigation.feature
Expand Up @@ -33,19 +33,12 @@ Feature: A user can navigate to previous and next discussions
Given the following "activities" exist:
| activity | name | course | idnumber | groupmode |
| forum | Test forum name | C1 | forum | 0 |
And the following "mod_forum > discussions" exist:
| user | forum | name | message |
| teacher1 | forum | Discussion 1 | Test post message |
| teacher1 | forum | Discussion 2 | Test post message |
| teacher1 | forum | Discussion 3 | Test post message |
And I am on the "Test forum name" "forum activity" page logged in as teacher1
And I add a new discussion to "Test forum name" forum with:
| Subject | Discussion 1 |
| Message | Test post message |
And I wait "1" seconds
And I add a new discussion to "Test forum name" forum with:
| Subject | Discussion 2 |
| Message | Test post message |
And I wait "1" seconds
And I add a new discussion to "Test forum name" forum with:
| Subject | Discussion 3 |
| Message | Test post message |
And I wait "1" seconds
When I follow "Discussion 3"
Then I should not see "Discussion 1"
And I should see "Discussion 2"
Expand All @@ -72,14 +65,16 @@ Feature: A user can navigate to previous and next discussions
Given the following "activities" exist:
| activity | name | course | idnumber | groupmode |
| forum | Test forum name | C1 | forum | 2 |
And the following forum discussions exist in course "Course 1":
| user | forum | name | message | group |
| teacher1 | Test forum name | Discussion 1 Group 0 | Test post message | |
| teacher1 | Test forum name | Discussion 2 Group 0 | Test post message | |
| teacher1 | Test forum name | Discussion 1 Group 1 | Test post message | G1 |
| teacher1 | Test forum name | Discussion 2 Group 1 | Test post message | G1 |
| teacher1 | Test forum name | Discussion 1 Group 2 | Test post message | G2 |
| teacher1 | Test forum name | Discussion 2 Group 2 | Test post message | G2 |
And the following "mod_forum > discussions" exist:
| user | forum | name | message |
| student1 | forum | Discussion 1 Group 0 | Test post message |
| student1 | forum | Discussion 2 Group 0 | Test post message |
And the following "mod_forum > discussions" exist:
| user | forum | name | message | group |
| student1 | forum | Discussion 1 Group 1 | Test post message | G1 |
| student1 | forum | Discussion 2 Group 1 | Test post message | G1 |
| student1 | forum | Discussion 1 Group 2 | Test post message | G2 |
| student1 | forum | Discussion 2 Group 2 | Test post message | G2 |
When I am on the "Test forum name" "forum activity" page logged in as student1
And I select "All participants" from the "Visible groups" singleselect
And I follow "Discussion 1 Group 0"
Expand All @@ -99,7 +94,7 @@ Feature: A user can navigate to previous and next discussions
And I follow "Test forum name"
And I select "Group 1" from the "Visible groups" singleselect
And I follow "Discussion 1 Group 1"
Then I should see "Discussion 2 Group 0"
And I should see "Discussion 2 Group 0"
And I should see "Discussion 2 Group 1"
And I follow "Discussion 2 Group 1"
And I should see "Discussion 1 Group 1"
Expand All @@ -109,14 +104,16 @@ Feature: A user can navigate to previous and next discussions
Given the following "activities" exist:
| activity | name | course | idnumber | groupmode |
| forum | Test forum name | C1 | forum | 1 |
And the following forum discussions exist in course "Course 1":
| user | forum | name | message | group |
| teacher1 | Test forum name | Discussion 1 Group 0 | Test post message | |
| teacher1 | Test forum name | Discussion 2 Group 0 | Test post message | |
| teacher1 | Test forum name | Discussion 1 Group 1 | Test post message | G1 |
| teacher1 | Test forum name | Discussion 2 Group 1 | Test post message | G1 |
| teacher1 | Test forum name | Discussion 1 Group 2 | Test post message | G2 |
| teacher1 | Test forum name | Discussion 2 Group 2 | Test post message | G2 |
And the following "mod_forum > discussions" exist:
| user | forum | name | message |
| student1 | forum | Discussion 1 Group 0 | Test post message |
| student1 | forum | Discussion 2 Group 0 | Test post message |
And the following "mod_forum > discussions" exist:
| user | forum | name | message | group |
| student1 | forum | Discussion 1 Group 1 | Test post message | G1 |
| student1 | forum | Discussion 2 Group 1 | Test post message | G1 |
| student1 | forum | Discussion 1 Group 2 | Test post message | G2 |
| student1 | forum | Discussion 2 Group 2 | Test post message | G2 |
When I am on the "Test forum name" "forum activity" page logged in as student1
And I follow "Discussion 1 Group 1"
Then I should see "Discussion 2 Group 0"
Expand Down

0 comments on commit 1967ccc

Please sign in to comment.