Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Public Member Functions | |
getSession ($name=null) | |
Returns the Mink session. More... | |
i_add_a_forum_discussion_to_forum_inline_with ($forumname, TableNode $table) | |
Adds a discussion to the forum specified by it's name with the provided table data (usually Subject and Message). More... | |
i_add_a_forum_discussion_to_forum_with ($forumname, TableNode $table) | |
Adds a discussion to the forum specified by it's name with the provided table data (usually Subject and Message). More... | |
i_add_a_new_question_to_forum_with ($forumname, TableNode $table) | |
Adds a Q&A discussion to the Q&A-type forum specified by it's name with the provided table data. More... | |
i_add_a_new_topic_to_forum_with ($forumname, TableNode $table) | |
Adds a topic to the forum specified by it's name. More... | |
i_can_subscribe_to_this_forum () | |
Checks if the user can subscribe to the forum. More... | |
i_can_unsubscribe_from_this_forum () | |
Checks if the user can unsubscribe from the forum. More... | |
i_click_on_action_menu ($discussion) | |
Opens up the action menu for the discussion. More... | |
i_navigate_to_post_in_forum ($postsubject, $forumname) | |
Navigates to a particular discussion page. More... | |
i_reply_post_from_forum_using_an_inpage_reply_with ($postsubject, $forumname, TableNode $table) | |
Inpage Reply - adds a reply to the specified post of the specified forum. More... | |
i_reply_post_from_forum_with ($postsubject, $forumname, TableNode $table) | |
Adds a reply to the specified post of the specified forum. More... | |
i_subscribe_to_this_forum () | |
Subscribes to the forum. More... | |
i_unsubscribe_from_this_forum () | |
Unsubscribes from the forum. More... | |
the_following_forum_discussions_exist (string $coursename, TableNode $discussionsdata) | |
Creates new discussions within forums of a given course. More... | |
the_following_forum_replies_exist (string $coursename, TableNode $repliesdata) | |
Creates replies to discussions within forums of a given course. More... | |
Public Attributes | |
const | EXTENDED_TIMEOUT = 10 |
And extended timeout for specific cases. More... | |
const | PAGE_READY_JS |
The JS code to check that the page is ready. More... | |
const | REDUCED_TIMEOUT = 2 |
Small timeout. More... | |
const | TIMEOUT = 6 |
The timeout for each Behat step (load page, wait for an element to load...). More... | |
Protected Member Functions | |
add_new_discussion ($forumname, TableNode $table, $buttonstr) | |
Returns the steps list to add a new discussion to a forum. More... | |
add_new_discussion_inline ($forumname, TableNode $table, $buttonstr) | |
Returns the steps list to add a new discussion to a forum inline. More... | |
create_post_attachments (int $postid, int $userid, array $attachmentnames, stdClass $cm, string $filearea) | |
Create one or more attached or inline attachments to a forum post. More... | |
fill_new_discussion_form (TableNode $table) | |
Fill in the forum's post form and submit. More... | |
get_base_discussion (int $forumid, string $name) | |
Fetch discussion ID and first post ID by discussion name. More... | |
get_course_id (string $coursename) | |
Fetch course ID using course name. More... | |
get_forum_id (int $courseid, string $forumname) | |
Fetch forum ID using forum name. More... | |
get_group_id (int $courseid, string $groupname) | |
Fetch Group ID using group name. More... | |
get_user_id ($username) | |
Fetch user ID from its username. More... | |
goto_main_post_reply ($postsubject) | |
Go to the default reply to post page. More... | |
|
protected |
Returns the steps list to add a new discussion to a forum.
Abstracts add a new topic and add a new discussion, as depending on the forum type the button string changes.
string | $forumname | |
TableNode | $table | |
string | $buttonstr |
|
protected |
Returns the steps list to add a new discussion to a forum inline.
Abstracts add a new topic and add a new discussion, as depending on the forum type the button string changes.
string | $forumname | |
TableNode | $table | |
string | $buttonstr |
|
protected |
Create one or more attached or inline attachments to a forum post.
int | $postid | The ID of the forum post. |
int | $userid | The user ID creating the attachment. |
array | $attachmentnames | Names of all attachments to be created. |
stdClass | $cm | The context module of the forum. |
string | $filearea | The file area being written to, eg 'attachment' or 'post' (inline). |
|
protected |
Fill in the forum's post form and submit.
It assumes you've already navigated and enabled the form for view.
TableNode | $table |
coding_exception |
|
protected |
Fetch discussion ID and first post ID by discussion name.
int | $forumid | The forum ID where the discussion resides. |
string | $name | The name of the discussion. |
array | The discussion ID and first post ID. |
dml_exception | If the discussion name is not unique within the forum (or doesn't exist). |
|
protected |
Fetch course ID using course name.
string | $coursename | The name of the course. |
int | The course ID. |
Exception |
|
protected |
Fetch forum ID using forum name.
int | $courseid | The course ID the forum exists within. |
string | $forumname | The name of the forum. |
int | The forum ID. |
Exception |
|
protected |
Fetch Group ID using group name.
int | $courseid | The course ID the forum exists within. |
string | $groupname | The short name of the group. |
int | The group ID. |
Exception |
|
protected |
Fetch user ID from its username.
string | $username | The username. |
int | The user ID. |
Exception |
|
inherited |
Returns the Mink session.
string | null | $name | name of the session OR active session will be used |
Behat::Mink::Session |
Implemented in behat_form_field.
|
protected |
Go to the default reply to post page.
This is used instead of navigating through 4-5 different steps and to solve issues where JS would be required to click on the advanced button
$postsubject |
coding_exception | |
dml_exception | |
moodle_exception |
behat_mod_forum::i_add_a_forum_discussion_to_forum_inline_with | ( | $forumname, | |
TableNode | $table | ||
) |
Adds a discussion to the forum specified by it's name with the provided table data (usually Subject and Message).
The step begins from the forum's course page.
@Given /^I add a new discussion to "(?P<forum_name_string>(?:[^"]|::")*)" forum inline with:$/
string | $forumname | |
TableNode | $table |
behat_mod_forum::i_add_a_forum_discussion_to_forum_with | ( | $forumname, | |
TableNode | $table | ||
) |
Adds a discussion to the forum specified by it's name with the provided table data (usually Subject and Message).
The step begins from the forum's course page.
@Given /^I add a new discussion to "(?P<forum_name_string>(?:[^"]|::")*)" forum with:$/
string | $forumname | |
TableNode | $table |
behat_mod_forum::i_add_a_new_question_to_forum_with | ( | $forumname, | |
TableNode | $table | ||
) |
Adds a Q&A discussion to the Q&A-type forum specified by it's name with the provided table data.
@Given /^I add a new question to "(?P<forum_name_string>(?:[^"]|::")*)" forum with:$/
string | $forumname | |
TableNode | $table |
behat_mod_forum::i_add_a_new_topic_to_forum_with | ( | $forumname, | |
TableNode | $table | ||
) |
Adds a topic to the forum specified by it's name.
Useful for the Announcements and blog-style forums.
@Given /^I add a new topic to "(?P<forum_name_string>(?:[^"]|::")*)" forum with:$/
string | $forumname | |
TableNode | $table |
behat_mod_forum::i_can_subscribe_to_this_forum | ( | ) |
Checks if the user can subscribe to the forum.
@Given /^I can subscribe to this forum$/
Reimplemented in behat_theme_classic_behat_mod_forum.
behat_mod_forum::i_can_unsubscribe_from_this_forum | ( | ) |
Checks if the user can unsubscribe from the forum.
@Given /^I can unsubscribe from this forum$/
Reimplemented in behat_theme_classic_behat_mod_forum.
behat_mod_forum::i_click_on_action_menu | ( | $discussion | ) |
Opens up the action menu for the discussion.
@Given /^I click on "(?P<post_subject_string>(?:[^"]|::")*)" action menu$/
string | $discussion | The subject of the discussion |
behat_mod_forum::i_navigate_to_post_in_forum | ( | $postsubject, | |
$forumname | |||
) |
Navigates to a particular discussion page.
@Given /^I navigate to post "(?P<post_subject_string>(?:[^"]|::")*)" in "(?P<forum_name_string>(?:[^"]|")*)" forum$/
string | $postsubject | The subject of the post |
string | $forumname | The forum name |
behat_mod_forum::i_reply_post_from_forum_using_an_inpage_reply_with | ( | $postsubject, | |
$forumname, | |||
TableNode | $table | ||
) |
Inpage Reply - adds a reply to the specified post of the specified forum.
The step begins from the forum's page or from the forum's course page.
@Given /^I reply "(?P<post_subject_string>(?:[^"]|::")*)" post from "(?P<forum_name_string>(?:[^"]|")*)" forum using an inpage reply with:$/
string | $postsubject | The subject of the post |
string | $forumname | The forum name |
TableNode | $table |
behat_mod_forum::i_reply_post_from_forum_with | ( | $postsubject, | |
$forumname, | |||
TableNode | $table | ||
) |
Adds a reply to the specified post of the specified forum.
The step begins from the forum's page or from the forum's course page.
@Given /^I reply "(?P<post_subject_string>(?:[^"]|::")*)" post from "(?P<forum_name_string>(?:[^"]|")*)" forum with:$/
string | $postname | The subject of the post |
string | $forumname | The forum name |
TableNode | $table |
behat_mod_forum::i_subscribe_to_this_forum | ( | ) |
Subscribes to the forum.
@Given /^I subscribe to this forum$/
Reimplemented in behat_theme_classic_behat_mod_forum.
behat_mod_forum::i_unsubscribe_from_this_forum | ( | ) |
Unsubscribes from the forum.
@Given /^I unsubscribe from this forum$/
Reimplemented in behat_theme_classic_behat_mod_forum.
behat_mod_forum::the_following_forum_discussions_exist | ( | string | $coursename, |
TableNode | $discussionsdata | ||
) |
Creates new discussions within forums of a given course.
@Given the following forum discussions exist in course :coursename:
string | $coursename | The full name of the course where the forums exist. |
TableNode | $discussionsdata | The discussion posts to be created. |
behat_mod_forum::the_following_forum_replies_exist | ( | string | $coursename, |
TableNode | $repliesdata | ||
) |
Creates replies to discussions within forums of a given course.
@Given the following forum replies exist in course :coursename:
string | $coursename | The full name of the course where the forums exist. |
TableNode | $repliesdata | The reply posts to be created. |
|
inherited |
And extended timeout for specific cases.
|
inherited |
The JS code to check that the page is ready.
The document must be complete and either M.util.pending_js must be empty, or it must not be defined at all.
|
inherited |
Small timeout.
A reduced timeout for cases where self::TIMEOUT is too much and a simple $this->getSession()->getPage()->find() could not be enough.
|
inherited |
The timeout for each Behat step (load page, wait for an element to load...).