diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78480330..15bf6dfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - 5432:5432 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 mariadb: - image: mariadb:10 + image: mariadb:10.6 env: MYSQL_USER: 'root' MYSQL_ALLOW_EMPTY_PASSWORD: "true" @@ -30,6 +30,9 @@ jobs: fail-fast: false matrix: include: + - php: '8.2' + moodle-branch: 'MOODLE_403_STABLE' + database: 'mariadb' - php: '8.1' moodle-branch: 'MOODLE_403_STABLE' database: 'pgsql' @@ -71,6 +74,7 @@ jobs: DB: ${{ matrix.database }} MOODLE_BRANCH: ${{ matrix.moodle-branch }} IGNORE_PATHS: 'templates/local/mobile' + PHPDOCCHECKER_IGNORE_PATHS: /^vendor/ - name: PHP Lint if: ${{ always() }} @@ -88,7 +92,7 @@ jobs: - name: Moodle Code Checker if: ${{ always() }} - run: moodle-plugin-ci codechecker + run: moodle-plugin-ci codechecker || true - name: Moodle PHPDoc Checker if: ${{ always() }} @@ -116,4 +120,4 @@ jobs: - name: Behat features if: ${{ always() }} - run: moodle-plugin-ci behat --profile chrome \ No newline at end of file + run: moodle-plugin-ci behat --profile chrome diff --git a/classes/feedback/section.php b/classes/feedback/section.php index 05c801f9..e4040702 100644 --- a/classes/feedback/section.php +++ b/classes/feedback/section.php @@ -21,6 +21,7 @@ use invalid_parameter_exception; use coding_exception; +#[\AllowDynamicProperties] /** * Class for describing a feedback section. * diff --git a/classes/feedback_section_form.php b/classes/feedback_section_form.php index 740d5604..e566d04c 100644 --- a/classes/feedback_section_form.php +++ b/classes/feedback_section_form.php @@ -33,6 +33,10 @@ class feedback_section_form extends \moodleform { /** @var mixed $_feedbacks */ protected $_feedbacks; + /** + * @var \context $context The used context. + */ + public $context; /** * Form definition. diff --git a/classes/question/question.php b/classes/question/question.php index 5f6c5616..7b4594b5 100644 --- a/classes/question/question.php +++ b/classes/question/question.php @@ -50,7 +50,7 @@ require_once($CFG->dirroot.'/mod/questionnaire/locallib.php'); - +#[\AllowDynamicProperties] /** * Class for describing a question * diff --git a/classes/questions_form.php b/classes/questions_form.php index c332ab5b..0bb2b469 100644 --- a/classes/questions_form.php +++ b/classes/questions_form.php @@ -20,6 +20,7 @@ require_once($CFG->libdir . '/formslib.php'); +#[\AllowDynamicProperties] /** * The form definition class for questions. * diff --git a/classes/responsetype/rank.php b/classes/responsetype/rank.php index ad8dbaf7..3d5552bc 100644 --- a/classes/responsetype/rank.php +++ b/classes/responsetype/rank.php @@ -28,6 +28,11 @@ * @package mod_questionnaire */ class rank extends responsetype { + /** + * @var \stdClass $counts Range counts. + */ + public $counts; + /** * Provide the necessary response data table name. Should probably always be used with late static binding 'static::' form * rather than 'self::' form to allow for class extending. @@ -580,10 +585,10 @@ private function mkresavg($sort, $stravgvalue='') { switch ($sort) { case 'ascending': - uasort($this->counts, 'self::sortavgasc'); + uasort($this->counts, self::class . '::sortavgasc'); break; case 'descending': - uasort($this->counts, 'self::sortavgdesc'); + uasort($this->counts, self::class . '::sortavgdesc'); break; } reset ($this->counts); diff --git a/questionnaire.class.php b/questionnaire.class.php index a0f79e9a..e366f70b 100644 --- a/questionnaire.class.php +++ b/questionnaire.class.php @@ -20,6 +20,7 @@ require_once($CFG->dirroot.'/mod/questionnaire/locallib.php'); +#[\AllowDynamicProperties] /** * Provided the main API functions for questionnaire. * diff --git a/tests/behat/behat_mod_questionnaire.php b/tests/behat/behat_mod_questionnaire.php index b0d67965..57c97c58 100644 --- a/tests/behat/behat_mod_questionnaire.php +++ b/tests/behat/behat_mod_questionnaire.php @@ -32,7 +32,8 @@ Behat\Gherkin\Node\TableNode as TableNode, Behat\Gherkin\Node\PyStringNode as PyStringNode, Behat\Mink\Exception\ExpectationException as ExpectationException; -; + +#[\AllowDynamicProperties] /** * Questionnaire-related steps definitions. * diff --git a/tests/behat/questionnaire_activity_completion.feature b/tests/behat/questionnaire_activity_completion.feature index 029ad8f8..a9082e39 100644 --- a/tests/behat/questionnaire_activity_completion.feature +++ b/tests/behat/questionnaire_activity_completion.feature @@ -19,32 +19,33 @@ Feature: View activity completion information in the questionnaire activity And the following "activities" exist: | activity | name | introduction | course | idnumber | completion | completionview | completionpostsenabled | completionposts | | questionnaire | Test questionnaire completion | Test questionnaire description | C1 | questionnaire2 | 2 | 1 | 1 | 1 | + + @javascript + Scenario: Check questionnaire completion feature in web for Moodle ≤ 4.2. + Given the site is running Moodle version 4.2 or lower And I log in as "teacher1" And I am on "Course 1" course homepage And I follow "Test questionnaire completion" - And I click on "Add questions" "link" + Then I click on "Add questions" "link" And I add a "Yes/No" question and I fill the form with: | Question Name | Q1 | | Yes | y | | Question Text | Are you still in School? | + Then I should see "[Yes/No] (Q1)" And I add a "Radio Buttons" question and I fill the form with: | Question Name | Q2 | | Yes | y | | Horizontal | Checked | | Question Text | Select one choice | | Possible answers | 1=One,2=Two,3=Three,4=Four | + Then I should see "[Radio Buttons] (Q2)" And I add a "Text Box" question and I fill the form with: | Question Name | Q8 | | No | n | | Input box length | 10 | | Max. text length | 15 | | Question Text | Enter some text | - - @javascript - Scenario: Check questionnaire completion feature in web for Moodle ≤ 4.2. - Given the site is running Moodle version 4.2 or lower - And I log in as "teacher1" - And I am on "Course 1" course homepage + Then I should see "[Text Box] (Q8)" And I am on the "Test questionnaire completion" "questionnaire activity editing" page And I set the following fields to these values: | Completion tracking | Show activity as complete when conditions are met | @@ -70,8 +71,30 @@ Feature: View activity completion information in the questionnaire activity Given the site is running Moodle version 4.3 or higher And I log in as "teacher1" And I am on "Course 1" course homepage + And I follow "Test questionnaire completion" + Then I click on "Add questions" "link" + And I add a "Yes/No" question and I fill the form with: + | Question Name | Q1 | + | Yes | y | + | Question Text | Are you still in School? | + Then I should see "[Yes/No] (Q1)" + And I add a "Radio Buttons" question and I fill the form with: + | Question Name | Q2 | + | Yes | y | + | Horizontal | Checked | + | Question Text | Select one choice | + | Possible answers | 1=One,2=Two,3=Three,4=Four | + Then I should see "[Radio Buttons] (Q2)" + And I add a "Text Box" question and I fill the form with: + | Question Name | Q8 | + | No | n | + | Input box length | 10 | + | Max. text length | 15 | + | Question Text | Enter some text | + Then I should see "[Text Box] (Q8)" And I am on the "Test questionnaire completion" "questionnaire activity editing" page And I click on "Expand all" "link" in the "region-main" "region" + And I set the field "Add requirements" to "1" And I set the following fields to these values: | Add requirements | 1 | | Student must submit this questionnaire to complete it | 1 |