Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

(no description)

File Size: 174 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 question/tests/behat/behat_question_base.php

Defines 1 class


Class: behat_core_question  - X-Ref

Behat navigation hooks for core_question.

resolve_page_url(string $page)   X-Ref
Convert page names to URLs for steps like 'When I am on the "[page name]" page'.

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

param: string $page name of the page, with the component name removed e.g. 'Admin notification'.
return: moodle_url the corresponding URL.

resolve_page_instance_url(string $type, string $identifier)   X-Ref
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            |

param: string $type identifies which type of page this is, e.g. 'Preview'.
param: string $identifier identifies the particular page, e.g. 'My question'.
return: moodle_url the corresponding URL.

find_question_by_name(string $questionname)   X-Ref
Find a question, and where it is, from the question name.

This is a helper used by resolve_page_instance_url.

param: string $questionname
return: array with three elemnets, int question id, a string 'cmid' or 'courseid',

change_question_to_nonexistant_type($questionname)   X-Ref
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.

param: string $questionname the question name.

remove_question_from_db($questionname)   X-Ref
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.

param: string $questionname the question name.