Skip to content

Commit

Permalink
Adding basic Behat test.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed Mar 2, 2024
1 parent 514fc62 commit 8de4159
Show file tree
Hide file tree
Showing 12 changed files with 176 additions and 180 deletions.
145 changes: 33 additions & 112 deletions .github/workflows/moodle-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,196 +41,117 @@ jobs:
moodle-branch: master
database: mariadb

- php: 8.2
moodle-branch: MOODLE_403_STABLE
- php: 8.1
moodle-branch: master
database: pgsql
- php: 8.2
moodle-branch: MOODLE_403_STABLE
- php: 8.1
moodle-branch: master
database: mariadb
- php: 8.1
moodle-branch: master
database: pgsql
- php: 8.1
moodle-branch: master
database: mariadb

- php: 8.2
moodle-branch: MOODLE_402_STABLE
moodle-branch: MOODLE_403_STABLE
database: pgsql
- php: 8.2
moodle-branch: MOODLE_402_STABLE
moodle-branch: MOODLE_403_STABLE
database: mariadb

- php: 8.1
moodle-branch: MOODLE_403_STABLE
database: pgsql
- php: 8.1
moodle-branch: MOODLE_403_STABLE
database: mariadb
- php: 8.1
- php: 8.0
moodle-branch: MOODLE_403_STABLE
database: pgsql
- php: 8.0
moodle-branch: MOODLE_403_STABLE
database: mariadb
- php: 8.2
moodle-branch: MOODLE_402_STABLE
database: pgsql
- php: 8.1
- php: 8.2
moodle-branch: MOODLE_402_STABLE
database: mariadb
- php: 8.1
moodle-branch: MOODLE_401_STABLE
moodle-branch: MOODLE_402_STABLE
database: pgsql
- php: 8.1
moodle-branch: MOODLE_401_STABLE
database: mariadb

- php: 8.0
moodle-branch: MOODLE_403_STABLE
database: pgsql
- php: 8.0
moodle-branch: MOODLE_403_STABLE
moodle-branch: MOODLE_402_STABLE
database: mariadb
- php: 8.0
moodle-branch: MOODLE_402_STABLE
database: pgsql
- php: 8.0
moodle-branch: MOODLE_402_STABLE
database: mariadb
- php: 8.0
- php: 8.1
moodle-branch: MOODLE_401_STABLE
database: pgsql
- php: 8.0
- php: 8.1
moodle-branch: MOODLE_401_STABLE
database: mariadb
- php: 8.0
moodle-branch: MOODLE_400_STABLE
moodle-branch: MOODLE_401_STABLE
database: pgsql
- php: 8.0
moodle-branch: MOODLE_400_STABLE
moodle-branch: MOODLE_401_STABLE
database: mariadb

- php: 7.4
moodle-branch: MOODLE_401_STABLE
database: pgsql
- php: 7.4
moodle-branch: MOODLE_401_STABLE
database: mariadb
- php: 7.4
- php: 8.0
moodle-branch: MOODLE_400_STABLE
database: pgsql
- php: 7.4
- php: 8.0
moodle-branch: MOODLE_400_STABLE
database: mariadb
- php: 7.4
moodle-branch: MOODLE_311_STABLE
moodle-branch: MOODLE_400_STABLE
database: pgsql
- php: 7.4
moodle-branch: MOODLE_311_STABLE
moodle-branch: MOODLE_400_STABLE
database: mariadb
- php: 7.4
moodle-branch: MOODLE_310_STABLE
moodle-branch: MOODLE_311_STABLE
database: pgsql
- php: 7.4
moodle-branch: MOODLE_310_STABLE
moodle-branch: MOODLE_311_STABLE
database: mariadb
- php: 7.4
moodle-branch: MOODLE_39_STABLE
database: pgsql
- php: 7.4
moodle-branch: MOODLE_39_STABLE
database: mariadb
- php: 7.4
moodle-branch: MOODLE_38_STABLE
database: pgsql
- php: 7.4
moodle-branch: MOODLE_38_STABLE
database: mariadb

- php: 7.3
moodle-branch: MOODLE_400_STABLE
database: pgsql
- php: 7.3
moodle-branch: MOODLE_400_STABLE
database: mariadb
- php: 7.3
moodle-branch: MOODLE_311_STABLE
database: pgsql
- php: 7.3
moodle-branch: MOODLE_311_STABLE
database: mariadb
- php: 7.3
moodle-branch: MOODLE_310_STABLE
database: pgsql
- php: 7.3
moodle-branch: MOODLE_310_STABLE
database: mariadb
- php: 7.3
moodle-branch: MOODLE_39_STABLE
database: pgsql
- php: 7.3
moodle-branch: MOODLE_39_STABLE
database: mariadb
- php: 7.3
moodle-branch: MOODLE_38_STABLE
database: pgsql
- php: 7.3
moodle-branch: MOODLE_38_STABLE
database: mariadb
- php: 7.3
moodle-branch: MOODLE_37_STABLE
database: pgsql
- php: 7.3
moodle-branch: MOODLE_37_STABLE
database: mariadb
- php: 7.3
moodle-branch: MOODLE_36_STABLE
database: pgsql
- php: 7.3
moodle-branch: MOODLE_36_STABLE
database: mariadb

- php: 7.2
moodle-branch: MOODLE_310_STABLE
database: pgsql
- php: 7.2
moodle-branch: MOODLE_310_STABLE
database: mariadb
- php: 7.2
moodle-branch: MOODLE_39_STABLE
database: pgsql
- php: 7.2
moodle-branch: MOODLE_39_STABLE
database: mariadb
- php: 7.2
moodle-branch: MOODLE_38_STABLE
database: pgsql
- php: 7.2
moodle-branch: MOODLE_38_STABLE
database: mariadb
- php: 7.2
moodle-branch: MOODLE_37_STABLE
database: pgsql
- php: 7.2
moodle-branch: MOODLE_37_STABLE
database: mariadb
- php: 7.2
moodle-branch: MOODLE_36_STABLE
database: pgsql
- php: 7.2
moodle-branch: MOODLE_36_STABLE
database: mariadb

- php: 7.1
moodle-branch: MOODLE_38_STABLE
database: pgsql
- php: 7.1
moodle-branch: MOODLE_38_STABLE
database: mariadb
- php: 7.1
moodle-branch: MOODLE_37_STABLE
database: pgsql
- php: 7.1
moodle-branch: MOODLE_37_STABLE
database: mariadb
- php: 7.1
moodle-branch: MOODLE_36_STABLE
database: pgsql
- php: 7.1
moodle-branch: MOODLE_36_STABLE
database: mariadb

- php: 7.0
moodle-branch: MOODLE_36_STABLE
database: mariadb

steps:
- name: Check out repository code
Expand Down
2 changes: 1 addition & 1 deletion classes/external/exporter/bool_dto.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected static function define_other_properties() {
return [
'result' => [
'type' => PARAM_BOOL,
'description' => 'a boolean value.'
'description' => 'a boolean value.',
],
];
}
Expand Down
4 changes: 2 additions & 2 deletions classes/external/exporter/tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ protected static function define_related() {
* @return array
*/
protected function get_other_values(\renderer_base $output) {
$values = array(
$values = [
'id' => $this->tab->id,
'tabtitle' => $this->tab->tabtitle,
'tabcolor' => $this->tab->tabcolor,
'targetinput' => $this->tab->targetinput,
);
];

return $values;
}
Expand Down
28 changes: 14 additions & 14 deletions classes/external/handlers.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class handlers extends \external_api {
*/
public static function get_handlers_parameters() {
return new external_function_parameters(
array (
[
'userid' => new external_value(PARAM_INT, 'userid'),
'learninggoalid' => new external_value(PARAM_INT, 'learninggoalid'),
)
]
);
}

Expand All @@ -67,37 +67,37 @@ public static function get_handlers_parameters() {
public static function get_handlers_returns() {
return new external_multiple_structure(
new external_single_structure(
array(
[
'tabs' => new external_multiple_structure(
new external_single_structure(
array(
[
'id' => new external_value(PARAM_INT, 'Tabulator id', VALUE_OPTIONAL),
'tabtitle' => new external_value(PARAM_TEXT, 'Tabulator title', VALUE_OPTIONAL),
'tabcolor' => new external_value(PARAM_TEXT, 'Tabulator color', VALUE_OPTIONAL),
'targetinput' => new external_value(PARAM_TEXT, 'Target input field', VALUE_OPTIONAL),
'categories' => new external_multiple_structure(
new external_single_structure(
array(
[
'parenttabid' => new external_value(PARAM_TEXT, 'Parent tabulator id', VALUE_OPTIONAL),
'cattitle' => new external_value(PARAM_TEXT, 'Category title', VALUE_OPTIONAL),
'cattext' => new external_value(PARAM_TEXT, 'Category text', VALUE_OPTIONAL),
'words' => new external_multiple_structure(
new external_single_structure(
array(
[
'title' => new external_value(PARAM_TEXT, 'Word title', VALUE_OPTIONAL),
'text' => new external_value(PARAM_TEXT, 'Word text', VALUE_OPTIONAL),
'targetinput' => new external_value(PARAM_TEXT,
'Learning goal text field to be filled'),
)
]
), 'Category words', VALUE_OPTIONAL
),
)
]
), 'Tabulator categories', VALUE_OPTIONAL
),
)
]
), 'Tabulators', VALUE_OPTIONAL
),
)
]
), 'Handler tabs', VALUE_OPTIONAL
);
}
Expand All @@ -112,10 +112,10 @@ public static function get_handlers_returns() {
*/
public static function get_handlers($userid, $learninggoalid) {
self::validate_parameters(self::get_handlers_parameters(),
array(
[
'userid' => $userid,
'learninggoalid' => $learninggoalid
)
'learninggoalid' => $learninggoalid,
]
);

self::validate_context(\context_system::instance());
Expand All @@ -125,7 +125,7 @@ public static function get_handlers($userid, $learninggoalid) {

// Do additional setup stuff.
$settings = external_settings::get_instance();
$displaylang = $settings->get_lang() ? $settings->get_lang() : ($SESSION->lang ? $SESSION->lang : $USER->lang);
$displaylang = $settings->get_lang() ? $settings->get_lang() : (isset($SESSION->lang) ? $SESSION->lang : $USER->lang);

$ctx = \context_system::instance();

Expand Down
Loading

0 comments on commit 8de4159

Please sign in to comment.