Moodle PHP Documentation 4.1
Moodle 4.1dev (Build: 20220512) (5e5e12e0)
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
behat_core_question Class Reference
Inheritance diagram for behat_core_question:
behat_question_base behat_base behat_session_interface behat_theme_classic_behat_core_question

Public Member Functions

 getSession ($name=null)
 Returns the Mink session. More...
 
 i_action_the_question ($action, $questionname)
 Activates a particular action on a particular question in the question bank UI. More...
 
 i_add_a_question_filling_the_form_with ($questiontypename, TableNode $questiondata)
 Creates a question in the current course questions bank with the provided data. More...
 
 i_click_on_question_bulk_action ($action)
 A click on a particular bulk action in the question bank UI. More...
 
 i_should_not_see_question_bulk_action ($action)
 A particular bulk action should not be visible in the question bank UI. More...
 
 i_should_see_question_bulk_action ($action)
 A particular bulk action is visible in the question bank UI. More...
 
 the_state_of_question_is_shown_as ($questiondescription, $state)
 Checks the state of the specified question. More...
 

Public Attributes

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

Protected Member Functions

 find_question_by_name (string $questionname)
 Find a question, and where it is, from the question name. More...
 
 finish_adding_question ($questiontypename, TableNode $questiondata)
 Helper used by i_add_a_question_filling_the_form_with() and to finish creating(). More...
 
 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'. More...
 
 resolve_page_url (string $page)
 Convert page names to URLs for steps like 'When I am on the "[page name]" page'. More...
 

Member Function Documentation

◆ find_question_by_name()

behat_core_question::find_question_by_name ( string  $questionname)
protected

Find a question, and where it is, from the question name.

This is a helper used by resolve_page_instance_url.

Parameters
string$questionname
Return values
arraywith three elemnets, int question id, a string 'cmid' or 'courseid', and int either cmid or courseid as applicable.

◆ finish_adding_question()

behat_question_base::finish_adding_question (   $questiontypename,
TableNode  $questiondata 
)
protectedinherited

Helper used by i_add_a_question_filling_the_form_with() and to finish creating().

Parameters
string$questiontypenameThe question type name
TableNode$questiondataThe data to fill the question type form

◆ 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_action_the_question()

behat_core_question::i_action_the_question (   $action,
  $questionname 
)

Activates a particular action on a particular question in the question bank UI.

@When I choose :action action for :questionname in the question bank

Parameters
string$actionthe label for the action you want to activate.
string$questionnamethe question name.

◆ i_add_a_question_filling_the_form_with()

behat_core_question::i_add_a_question_filling_the_form_with (   $questiontypename,
TableNode  $questiondata 
)

Creates a question in the current course questions bank with the provided data.

This step can only be used when creating question types composed by a single form.

@Given /^I add a "(?P<question_type_name_string>(?:[^"]|::")*)" question filling the form with:$/

Parameters
string$questiontypenameThe question type name
TableNode$questiondataThe data to fill the question type form.

Reimplemented in behat_theme_classic_behat_core_question.

◆ i_click_on_question_bulk_action()

behat_core_question::i_click_on_question_bulk_action (   $action)

A click on a particular bulk action in the question bank UI.

@When I click on question bulk action :action

Parameters
string$actionthe value of the input for the action.

◆ i_should_not_see_question_bulk_action()

behat_core_question::i_should_not_see_question_bulk_action (   $action)

A particular bulk action should not be visible in the question bank UI.

@When I should not see question bulk action :action

Parameters
string$actionthe value of the input for the action.

◆ i_should_see_question_bulk_action()

behat_core_question::i_should_see_question_bulk_action (   $action)

A particular bulk action is visible in the question bank UI.

@When I should see question bulk action :action

Parameters
string$actionthe value of the input for the action.

◆ resolve_page_instance_url()

behat_core_question::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: | pagetype | name meaning | description | | course question bank | Course name | The question bank for a course | | course question import | Course name | The import questions screen for a course | | course question export | Course name | The export questions screen for a course | | preview | Question name | The screen to preview a question | | edit | Question name | The screen to edit a question |

Parameters
string$typeidentifies which type of page this is, e.g. 'Preview'.
string$identifieridentifies the particular page, e.g. 'My question'.
Return values
moodle_urlthe corresponding URL.
Exceptions
Exceptionwith a meaningful error message if the specified page cannot be found.

◆ resolve_page_url()

behat_core_question::resolve_page_url ( string  $page)
protected

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

Recognised page names are: | None so far! | |

Parameters
string$pagename of the page, with the component name removed e.g. 'Admin notification'.
Return values
moodle_urlthe corresponding URL.
Exceptions
Exceptionwith a meaningful error message if the specified page cannot be found.

◆ the_state_of_question_is_shown_as()

behat_core_question::the_state_of_question_is_shown_as (   $questiondescription,
  $state 
)

Checks the state of the specified question.

@Then /^the state of "(?P<question_description_string>(?:[^"]|::")*)" question is shown as "(?P<state_string>(?:[^"]|")*)"$/

Exceptions
ExpectationException
ElementNotFoundException
Parameters
string$questiondescription
string$state

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: