Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
behat_course Class Reference

Course-related steps definitions. More...

Inheritance diagram for behat_course:
behat_base behat_session_interface behat_theme_classic_behat_course

Public Member Functions

 getSession ($name=null)
 Returns the Mink session.
 
 i_add_to_course_section (string $activity, string $coursefullname, string $sectionnum)
 Open a add activity form page.
 
 i_add_to_course_section_and_i_fill_the_form_with ($activity, $coursefullname, $section, TableNode $data)
 Adds the selected activity/resource filling the form data with the specified field/value pairs.
 
 i_add_to_section_using_the_activity_chooser ($activityname, $sectionnum)
 Opens the activity chooser and opens the activity/resource link form page.
 
 i_create_a_course_with (TableNode $table)
 Creates a new course with the provided table data matching course settings names with the desired values.
 
 i_go_to_the_courses_management_page ()
 Goes to the system courses/categories management page.
 

Static Public Member Functions

static get_named_replacements ()
 Return a list of the Mink named replacements for the component.
 
static get_partial_named_selectors ()
 Return the list of partial named selectors.
 

Public Attributes

const PAGE_READY_JS
 The JS code to check that the page is ready.
 

Protected Member Functions

 resolve_page_instance_url (string $type, string $identifier)
 Convert page names to URLs for steps like 'When I am on the "[identifier]" "[page type]" page'.
 

Detailed Description

Course-related steps definitions.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ get_named_replacements()

static behat_course::get_named_replacements ( )
static

Return a list of the Mink named replacements for the component.

Named replacements allow you to define parts of an xpath that can be reused multiple times, or in multiple xpaths.

This method should return a list of behat_component_named_replacement and the docs on that class explain how it works.

Return values
behat_component_named_replacement[]

◆ get_partial_named_selectors()

static behat_course::get_partial_named_selectors ( )
static

Return the list of partial named selectors.

Return values
array

◆ getSession()

behat_session_interface::getSession ( $name = null)
inherited

Returns the Mink session.

Parameters
string | null$namename of the session OR active session will be used
Return values
Behat\Mink\Session

Implemented in behat_form_field.

◆ i_add_to_course_section()

behat_course::i_add_to_course_section ( string $activity,
string $coursefullname,
string $sectionnum )

Open a add activity form page.

@Given I add a :activity activity to course :coursefullname section :sectionnum @Given I add an :activity activity to course :coursefullname section :sectionnum

Exceptions
coding_exception
Parameters
string$activityThe activity name.
string$coursefullnameThe course full name of the course.
string$sectionnumThe section number.

◆ i_add_to_course_section_and_i_fill_the_form_with()

behat_course::i_add_to_course_section_and_i_fill_the_form_with ( $activity,
$coursefullname,
$section,
TableNode $data )

Adds the selected activity/resource filling the form data with the specified field/value pairs.

Sections 0 and 1 are also allowed on frontpage.

@Given I add a :activity activity to course :coursefullname section :sectionnum and I fill the form with: @Given I add an :activity activity to course :coursefullname section :sectionnum and I fill the form with:

Parameters
string$activityThe activity name
string$coursefullnameThe course full name of the course.
int$sectionThe section number
TableNode$dataThe activity field/value data

◆ i_add_to_section_using_the_activity_chooser()

behat_course::i_add_to_section_using_the_activity_chooser ( $activityname,
$sectionnum )

Opens the activity chooser and opens the activity/resource link form page.

Sections 0 and 1 are also allowed on frontpage.

This step require javascript enabled and it is used mainly to click activities or resources by name, not by plugin name. Use the standard behat_course\i_add_to_course_section step instead unless the plugin create extra entries into the activity chooser (like LTI).

@Given I add a :activityname to section :sectionnum using the activity chooser @Given I add an :activityname to section :sectionnum using the activity chooser

Exceptions
ElementNotFoundExceptionThrown by behat_base\find
Parameters
string$activityname
int$sectionnum

◆ i_create_a_course_with()

behat_course::i_create_a_course_with ( TableNode $table)

Creates a new course with the provided table data matching course settings names with the desired values.

@Given /^I create a course with:$/

Parameters
TableNode$tableThe course data

◆ i_go_to_the_courses_management_page()

behat_course::i_go_to_the_courses_management_page ( )

Goes to the system courses/categories management page.

@Given /^I go to the courses management page$/

◆ resolve_page_instance_url()

behat_course::resolve_page_instance_url ( string $type,
string $identifier )
protected

Convert page names to URLs for steps like 'When I am on the "[identifier]" "[page type]" page'.

Recognised page names are: | Section | coursename > section | The selected course section. First it searchs by section name, then by section number. |

Examples:

When I am on the "Course 1 > Section 1" "course > section" page logged in as "admin" When I am on the "Course 1 > Named section" "course > section" page logged in as "admin"

Parameters
string$type
string$identifier
Return values
moodle_url

Member Data Documentation

◆ PAGE_READY_JS

const behat_session_interface::PAGE_READY_JS
inherited
Initial value:
= "document.readyState === 'complete' && " .
"(typeof M !== 'object' || typeof M.util !== 'object' || " .
"typeof M.util.pending_js === 'undefined' || M.util.pending_js.length === 0)"

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.


The documentation for this class was generated from the following file: