mirror of
https://github.com/moodle/moodle.git
synced 2025-03-19 23:20:09 +01:00
Merge branch 'MDL-78843-401' of https://github.com/lameze/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
45bd1bfa49
@ -18,17 +18,12 @@ Feature: Latest announcements block displays the course latest news
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| news_items | Course | C1 | course-view-* | side-pre |
|
||||
And I am on the "Course 1" Course page logged in as teacher1
|
||||
When I add a new topic to "Announcements" forum with:
|
||||
| Subject | Discussion One |
|
||||
| Message | Not important |
|
||||
And I add a new topic to "Announcements" forum with:
|
||||
| Subject | Discussion Two |
|
||||
| Message | Not important |
|
||||
And I add a new topic to "Announcements" forum with:
|
||||
| Subject | Discussion Three |
|
||||
| Message | Not important |
|
||||
And I am on "Course 1" course homepage
|
||||
And the following "mod_forum > discussions" exist:
|
||||
| user | forum | name | message |
|
||||
| teacher1 | Announcements | Discussion One | Not important |
|
||||
| teacher1 | Announcements | Discussion Two | Not important |
|
||||
| teacher1 | Announcements | Discussion Three | Not important |
|
||||
When I am on the "Course 1" Course page logged in as teacher1
|
||||
Then I should see "Discussion One" in the "Latest announcements" "block"
|
||||
And I should see "Discussion Two" in the "Latest announcements" "block"
|
||||
And I should see "Discussion Three" in the "Latest announcements" "block"
|
||||
|
@ -23,6 +23,9 @@ Feature: The search forums block allows users to search for forum posts on cours
|
||||
And I am on the "Course 1" "course editing" page logged in as teacher1
|
||||
And I set the field "id_newsitems" to "1"
|
||||
And I press "Save and display"
|
||||
And the following "mod_forum > discussions" exist:
|
||||
| user | forum | name | message |
|
||||
| teacher1 | Announcements | My subject | My message |
|
||||
|
||||
Scenario: Use the search forum block in a course without any forum posts
|
||||
Given I am on the "Course 1" course page logged in as student1
|
||||
@ -31,12 +34,7 @@ Feature: The search forums block allows users to search for forum posts on cours
|
||||
Then I should see "No posts"
|
||||
|
||||
Scenario: Use the search forum block in a course with a hidden forum and search for posts
|
||||
Given I add a new topic to "Announcements" forum with:
|
||||
| Subject | My subject |
|
||||
| Message | My message |
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I follow "Announcements"
|
||||
And I navigate to "Settings" in current page administration
|
||||
Given I am on the "Announcements" "forum activity editing" page logged in as teacher1
|
||||
And I expand all fieldsets
|
||||
And I set the field "id_visible" to "0"
|
||||
And I press "Save and return to course"
|
||||
@ -47,10 +45,7 @@ Feature: The search forums block allows users to search for forum posts on cours
|
||||
Then I should see "No posts"
|
||||
|
||||
Scenario: Use the search forum block in a course and search for posts
|
||||
Given I add a new topic to "Announcements" forum with:
|
||||
| Subject | My subject |
|
||||
| Message | My message |
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
Given I am on the "Course 1" course page logged in as student1
|
||||
And "Search forums" "block" should exist
|
||||
And I set the field "Search" to "message"
|
||||
And I press "Search"
|
||||
|
@ -11,8 +11,8 @@ Feature: The forum search allows users to perform advanced searches for forum po
|
||||
| teacher2 | Teacher | TWO | teacher2@example.com | T1 |
|
||||
| student1 | Student | 1 | student1@example.com | S1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
| fullname | shortname | category | newsitems |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
@ -24,17 +24,10 @@ Feature: The forum search allows users to perform advanced searches for forum po
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| news_items | Course | C1 | course-view-* | side-pre |
|
||||
And I am on the "Course 1" "course editing" page logged in as teacher1
|
||||
And I expand all fieldsets
|
||||
And I set the field "id_newsitems" to "1"
|
||||
And I press "Save and display"
|
||||
And I add a new topic to "Announcements" forum with:
|
||||
| Subject | My subject |
|
||||
| Message | My message |
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a new topic to "Announcements" forum with:
|
||||
| Subject | Your subjective|
|
||||
| Message | Your long message |
|
||||
And the following "mod_forum > discussions" exist:
|
||||
| user | forum | name | subject | message |
|
||||
| teacher1 | Announcements | My subject | My subject | My message |
|
||||
| teacher1 | Announcements | Your subjective | Your subjective | Your long message |
|
||||
|
||||
Scenario: Perform an advanced search using any term
|
||||
Given I am on the "Announcements" "forum activity" page logged in as student1
|
||||
@ -77,12 +70,11 @@ Feature: The forum search allows users to perform advanced searches for forum po
|
||||
And I should see "Your subjective"
|
||||
|
||||
Scenario: Perform an advanced search matching the author
|
||||
Given I am on the "Course 1" course page logged in as teacher2
|
||||
And I add a new topic to "Announcements" forum with:
|
||||
| Subject | My Subjects |
|
||||
| Message | My message |
|
||||
When I am on the "Announcements" "forum activity" page logged in as student1
|
||||
And I press "Search"
|
||||
Given the following "mod_forum > discussions" exist:
|
||||
| user | forum | name | subject | message |
|
||||
| teacher2 | Announcements | My Subjects | My Subjects | My message |
|
||||
And I am on the "Announcements" "forum activity" page logged in as student1
|
||||
When I press "Search"
|
||||
And I should see "Please enter search terms into one or more of the following fields"
|
||||
And I set the field "user" to "TWO"
|
||||
And I press "Search"
|
||||
|
@ -47,19 +47,13 @@ class behat_mod_forum_generator extends behat_generator_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the forum id using an activity idnumber.
|
||||
* Get the forum id using an activity idnumber or name.
|
||||
*
|
||||
* @param string $idnumber
|
||||
* @param string $idnumberorname The forum activity idnumber or name.
|
||||
* @return int The forum id
|
||||
*/
|
||||
protected function get_forum_id(string $idnumber): int {
|
||||
global $DB;
|
||||
|
||||
if (!$id = $DB->get_field('course_modules', 'instance', ['idnumber' => $idnumber])) {
|
||||
throw new Exception('The specified activity with idnumber "' . $idnumber . '" could not be found.');
|
||||
}
|
||||
|
||||
return $id;
|
||||
protected function get_forum_id(string $idnumberorname): int {
|
||||
return $this->get_cm_by_activity_name('forum', $idnumberorname)->instance;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user