- Copyright
- 2013 David MonllaĆ³
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ action_exists()
behat_core_question::action_exists |
( |
| $action, |
|
|
| $questionname ) |
Checks that action does exist for a question.
@Then the :action action should exist for the :questionname question in the question bank
- Parameters
-
string | $action | the label for the action you want to activate. |
string | $questionname | the question name. |
◆ action_not_exists()
behat_core_question::action_not_exists |
( |
| $action, |
|
|
| $questionname ) |
Checks that action does not exist for a question.
@Then the :action action should not exist for the :questionname question in the question bank
- Parameters
-
string | $action | the label for the action you want to activate. |
string | $questionname | the question name. |
◆ change_question_to_nonexistant_type()
behat_core_question::change_question_to_nonexistant_type |
( |
| $questionname | ) |
|
Change the question type of the give question to a type that does not exist.
This is useful for testing robustness of the code when a question type has been uninstalled, even though there are still questions of that type or attempts at them.
In order to set things up, you probably need to start by generating questions of a valid type, then using this to change the type once the data is created.
@Given question :questionname is changed to simulate being of an uninstalled type
- Parameters
-
string | $questionname | the question name. |
◆ 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
-
- Return values
-
array | with 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 |
◆ getSession()
behat_session_interface::getSession |
( |
| $name = null | ) |
|
|
inherited |
Returns the Mink session.
- Parameters
-
string | null | $name | name of the session OR active session will be used |
- Return values
-
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 | $action | the label for the action you want to activate. |
string | $questionname | the 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 | $questiontypename | The question type name |
TableNode | $questiondata | The data to fill the question type form. |
Reimplemented in behat_theme_classic_behat_core_question.
◆ i_add_question_bank_filter()
behat_core_question::i_add_question_bank_filter |
( |
string | $filtertype | ) |
|
Add a question bank filter.
This will add the filter if it does not exist, but leave the value empty.
@When I add question bank filter :filtertype
- Parameters
-
string | $filtertype | The filter we are adding |
◆ i_apply_question_bank_filter()
behat_core_question::i_apply_question_bank_filter |
( |
string | $filtertype, |
|
|
string | $value ) |
Apply question bank filter.
This will change the existing value of the specified filter, or add the filter and set its value if it doesn't already exist.
@When I apply question bank filter :filtertype with value :value
- Parameters
-
string | $filtertype | The filter to apply. This should match the get_title() return value from the filter's condition class. |
string | $value | The value to set for the condition. |
◆ 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 | $action | the 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 | $action | the 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 | $action | the value of the input for the action. |
◆ remove_question_from_db()
behat_core_question::remove_question_from_db |
( |
| $questionname | ) |
|
Forcibly delete a question from the database.
This is useful for testing robustness of the code when a question record is no longer in the database, even though it is referred to. Obviously, this should never happen, but it has been known to in the past and so we sometimes need to be able to test the code can handle this situation.
In order to set things up, you probably need to start by generating a valid questions, then using this to remove it once the data is created.
@Given question :questionname no longer exists in the database
- Parameters
-
string | $questionname | the question name. |
◆ 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 | $type | identifies which type of page this is, e.g. 'Preview'. |
string | $identifier | identifies the particular page, e.g. 'My question'. |
- Return values
-
- Exceptions
-
Exception | with 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 | $page | name of the page, with the component name removed e.g. 'Admin notification'. |
- Return values
-
- Exceptions
-
Exception | with 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 | |
◆ 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:
- question/tests/behat/behat_core_question.php