Skip to content

Commit

Permalink
Fix code review #778312
Browse files Browse the repository at this point in the history
  • Loading branch information
Hieu Nguyen Dang authored and timhunt committed Apr 17, 2024
1 parent 5c5cfb2 commit 301f52f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 55 deletions.
1 change: 0 additions & 1 deletion .github/workflows/moodle-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
# - each moodle version at least once
# - each database at least once
include:
- {php: '7.3', moodle-branch: MOODLE_400_STABLE, database: pgsql}
- {php: '7.4', moodle-branch: MOODLE_401_STABLE, database: mariadb}
- {php: '8.0', moodle-branch: MOODLE_402_STABLE, database: pgsql}
- {php: '8.2', moodle-branch: MOODLE_403_STABLE, database: mariadb}
Expand Down
6 changes: 3 additions & 3 deletions tests/behat/add_studentquiz.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Feature: Activities can be created

@javascript
Scenario: Check an Activity can be created
When I add a StudentQuiz to course "Course 1" section "1" and I fill the form with:
When I add a studentquiz activity to course "Course 1" section "1" and I fill the form with:
| StudentQuiz Name | Test quiz name |
| Description | Test quiz description |
And I am on the "Test quiz name" "mod_studentquiz > View" page
Then I should see "Create new question"

@javascript
Scenario: Check an Activity can be created with comment deletion period = 0.
When I add a StudentQuiz to course "Course 1" section "1" and I fill the form with:
When I add a studentquiz activity to course "Course 1" section "1" and I fill the form with:
| StudentQuiz Name | Test quiz name |
| Description | Test quiz description |
| Comment editing/deletion period (minutes) | 0 |
Expand All @@ -38,7 +38,7 @@ Feature: Activities can be created

@javascript
Scenario: Check an Activity can not be created with invalid date restriction.
Given I add a StudentQuiz to course "Course 1" section "1"
Given I add a studentquiz activity to course "Course 1" section "1"
And I set the following fields to these values:
| StudentQuiz Name | Test SQ name |
| Description | Test SQ description |
Expand Down
4 changes: 2 additions & 2 deletions tests/behat/admin_settings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Feature: New activities instances setting will be inherited from Admin setting
And the following config values are set as admin:
| defaultqtypes | truefalse | studentquiz |
And I am on "Course 1" course homepage with editing mode on
And I add a StudentQuiz to course "Course 1" section "1"
And I add a studentquiz activity to course "Course 1" section "1"
And I expand all fieldsets
Then the following fields match these values:
| allowedqtypes[truefalse] | 1 |
Expand All @@ -34,7 +34,7 @@ Feature: New activities instances setting will be inherited from Admin setting
And I press "Cancel"
And the following config values are set as admin:
| defaultqtypes | truefalse,multichoice | studentquiz |
And I add a StudentQuiz to course "Course 1" section "1"
And I add a studentquiz activity to course "Course 1" section "1"
And I expand all fieldsets
And the following fields match these values:
| allowedqtypes[truefalse] | 1 |
Expand Down
47 changes: 0 additions & 47 deletions tests/behat/behat_mod_studentquiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,51 +255,4 @@ function($context, $args) {
return true;
}, $node, behat_base::get_reduced_timeout(), $exception, true);
}

/**
* Add specific the studentquiz to course section and fill with values.
*
* @Given I add a StudentQuiz to course :coursefullname section :sectionnum and I fill the form with:
* @param string $coursefullname The course full name of the course.
* @param int $section The section number.
* @param TableNode $data The activity field/value data.
*/
public function add_to_course_section_and_fill_values($coursefullname, $section , TableNode $data) {
if (method_exists('behat_course', 'i_add_to_course_section_and_i_fill_the_form_with')) {
$this->execute('behat_course::i_add_to_course_section_and_i_fill_the_form_with', [
'studentquiz',
$coursefullname,
$section,
$data,
]);
} else {
// This step works only for Moodle 4.3 and earlier versions.
$this->execute(
'behat_course::i_add_to_section_and_i_fill_the_form_with', ['StudentQuiz', $section, $data]
);
}
}

/**
* Add specific studentquiz to a course section.
*
* @Given I add a StudentQuiz to course :coursefullname section :sectionnum
* @param string $coursefullname The course full name of the course.
* @param int $section The section number.
*/
public function add_studentquiz_to_course_section($coursefullname, $section) {
if (method_exists('behat_course', 'i_add_to_course_section')) {
$this->execute('behat_course::i_add_to_course_section', [
'studentquiz',
$coursefullname,
$section,
]);
} else {
// This step works only for Moodle 4.3 and earlier versions.
$this->execute('behat_course::i_add_to_section', [
'StudentQuiz',
$section,
]);
}
}
}
4 changes: 2 additions & 2 deletions tests/behat/question_submission_answering_phases.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Feature: Question submission and answering will follow the availability setting
Scenario: New availability settings should exist
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a StudentQuiz to course "Course 1" section "1"
And I add a studentquiz activity to course "Course 1" section "1"
And I expand all fieldsets
Then I should see "Open for question submission from"
And I should see "Closed for question submission from"
Expand All @@ -32,7 +32,7 @@ Feature: Question submission and answering will follow the availability setting
Scenario: Availability settings validation
When I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a StudentQuiz to course "Course 1" section "1"
And I add a studentquiz activity to course "Course 1" section "1"
And I expand all fieldsets
And I set the field "id_name" to "StudentQuiz Test Availability"

Expand Down

0 comments on commit 301f52f

Please sign in to comment.