From 301f52f266046d36bcf10816eded303da0ec7068 Mon Sep 17 00:00:00 2001 From: Hieu Nguyen Dang Date: Wed, 17 Apr 2024 19:16:55 +0700 Subject: [PATCH] Fix code review #778312 --- .github/workflows/moodle-plugin-ci.yml | 1 - tests/behat/add_studentquiz.feature | 6 +-- tests/behat/admin_settings.feature | 4 +- tests/behat/behat_mod_studentquiz.php | 47 ------------------- ...estion_submission_answering_phases.feature | 4 +- 5 files changed, 7 insertions(+), 55 deletions(-) diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml index 86c40855..89a57083 100644 --- a/.github/workflows/moodle-plugin-ci.yml +++ b/.github/workflows/moodle-plugin-ci.yml @@ -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} diff --git a/tests/behat/add_studentquiz.feature b/tests/behat/add_studentquiz.feature index 986b6fdd..d374c86a 100644 --- a/tests/behat/add_studentquiz.feature +++ b/tests/behat/add_studentquiz.feature @@ -19,7 +19,7 @@ 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 @@ -27,7 +27,7 @@ Feature: Activities can be created @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 | @@ -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 | diff --git a/tests/behat/admin_settings.feature b/tests/behat/admin_settings.feature index 3043b8e2..841f6f45 100644 --- a/tests/behat/admin_settings.feature +++ b/tests/behat/admin_settings.feature @@ -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 | @@ -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 | diff --git a/tests/behat/behat_mod_studentquiz.php b/tests/behat/behat_mod_studentquiz.php index 51795f3d..a337c7d1 100644 --- a/tests/behat/behat_mod_studentquiz.php +++ b/tests/behat/behat_mod_studentquiz.php @@ -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, - ]); - } - } } diff --git a/tests/behat/question_submission_answering_phases.feature b/tests/behat/question_submission_answering_phases.feature index fbd711b2..41650b91 100644 --- a/tests/behat/question_submission_answering_phases.feature +++ b/tests/behat/question_submission_answering_phases.feature @@ -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" @@ -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"