Skip to content

Issue #83: Updated install.xml using the XMLDB Editor - #84

Open
niko-hoogeveen wants to merge 1 commit into
ndunand:masterfrom
niko-hoogeveen:master-issue83
Open

Issue #83: Updated install.xml using the XMLDB Editor#84
niko-hoogeveen wants to merge 1 commit into
ndunand:masterfrom
niko-hoogeveen:master-issue83

Conversation

@niko-hoogeveen

Copy link
Copy Markdown

Closes Issue #83.

This MR updates the install.xml to comply with Moodle's latest standards for install.xml files in plugins. I did this update using the XMLDB editor to ensure proper formatting.

See here for the related tracker: https://moodle.atlassian.net/browse/MDL-85666

Environment Details

  • PHP 8.1
  • MOODLE 4.5
  • Postgres 16.0

Branch that has the issue:

  • master

How to recreate the issue?

  1. Deploy a local Moodle 4.5 instance (with this plugin installed on branch master)
  2. Initialize PHPUnit testing environment
  3. Run vendor/bin/phpunit lib/tests/db/plugin_checks.php

Actual Output:

Moodle 4.5.5+ (Build: 20250718), c97987e9ed119e45d78cd022405864445b96d7e4
Php: 8.1.28, pgsql: 16.0 (Debian 16.0-1.pgdg120+1), OS: Linux 6.8.0-64-generic x86_64
PHPUnit 9.6.18 by Sebastian Bergmann and contributors.

.....................F.........................................  63 / 449 ( 14%)
............................................................... 126 / 449 ( 28%)
............................................................... 189 / 449 ( 42%)
............................................................... 252 / 449 ( 56%)
............................................................... 315 / 449 ( 70%)
............................................................... 378 / 449 ( 84%)
............................................................... 441 / 449 ( 98%)
........                                                        449 / 449 (100%)

Time: 00:11.262, Memory: 46.00 MB

There was 1 failure:

1) core\db\plugin_checks_test::test_db_install_file with data set "qtype_matrix" ('qtype_matrix', 'qtype', 'matrix', '/var/www/moodle405/question/t...matrix')
XMLDB structure does not match the install.xml file in /var/www/moodle405/question/type/matrix/db/install.xml
Failed asserting that two DOM documents are equal.
--- Expected
+++ Actual
@@ @@
 <?xml version="1.0"?>
 <XMLDB xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" COMMENT="XMLDB file for Moodle question/type/matrix" PATH="question/type/matrix/db" VERSION="20090313" xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd">
   <TABLES>
-    <TABLE COMMENT="Contains info about matrix questions" NAME="qtype_matrix" NEXT="qtype_matrix_cols">
+    <TABLE COMMENT="Contains info about matrix questions" NAME="qtype_matrix">
       <FIELDS>
-        <FIELD LENGTH="10" NAME="id" NEXT="questionid" NOTNULL="true" SEQUENCE="true" TYPE="int" UNSIGNED="true"/>
-        <FIELD COMMENT="FK to question table" LENGTH="10" NAME="questionid" NEXT="grademethod" NOTNULL="true" PREVIOUS="id" SEQUENCE="false" TYPE="int" UNSIGNED="true"/>
-        <FIELD COMMENT="what the grading method is for this question.  Should match a constant in phpcode, QTYPE_MATRIX_GRADING_*" LENGTH="small" NAME="grademethod" NEXT="multiple" NOTNULL="true" PREVIOUS="questionid" SEQUENCE="false" TYPE="text"/>
-        <FIELD COMMENT="whether this question is allowed multiple choice (eg checkboxes rather than radio buttons)" DEFAULT="1" LENGTH="1" NAME="multiple" NEXT="usedndui" NOTNULL="true" PREVIOUS="grademethod" SEQUENCE="false" TYPE="int" UNSIGNED="true"/>
-        <FIELD COMMENT="Use drag and drop UI?" DEFAULT="0" LENGTH="1" NAME="usedndui" NEXT="shuffleanswers" NOTNULL="true" PREVIOUS="multiple" SEQUENCE="false" TYPE="int" UNSIGNED="true"/>
-        <FIELD COMMENT="Shuffle answer statements?" DEFAULT="1" LENGTH="1" NAME="shuffleanswers" NEXT="renderer" NOTNULL="true" PREVIOUS="usedndui" SEQUENCE="false" TYPE="int" UNSIGNED="true"/>
-        <FIELD COMMENT="the type of renderer to use to draw the student ui (eg, could be drag and drop later, but is 'matrix' for now).  should match a class: qtype_matrix_renderer_{$value}" LENGTH="small" NAME="renderer" NOTNULL="true" PREVIOUS="multiple" SEQUENCE="false" TYPE="text"/>
+        <FIELD LENGTH="10" NAME="id" NOTNULL="true" SEQUENCE="true" TYPE="int"/>
+        <FIELD COMMENT="FK to question table" LENGTH="10" NAME="questionid" NOTNULL="true" SEQUENCE="false" TYPE="int"/>
+        <FIELD COMMENT="what the grading method is for this question.  Should match a constant in phpcode, QTYPE_MATRIX_GRADING_*" NAME="grademethod" NOTNULL="true" SEQUENCE="false" TYPE="text"/>
+        <FIELD COMMENT="whether this question is allowed multiple choice (eg checkboxes rather than radio buttons)" DEFAULT="1" LENGTH="1" NAME="multiple" NOTNULL="true" SEQUENCE="false" TYPE="int"/>
+        <FIELD COMMENT="Use drag and drop UI?" DEFAULT="0" LENGTH="1" NAME="usedndui" NOTNULL="true" SEQUENCE="false" TYPE="int"/>
+        <FIELD COMMENT="Shuffle answer statements?" DEFAULT="1" LENGTH="1" NAME="shuffleanswers" NOTNULL="true" SEQUENCE="false" TYPE="int"/>
+        <FIELD COMMENT="the type of renderer to use to draw the student ui (eg, could be drag and drop later, but is 'matrix' for now).  should match a class: qtype_matrix_renderer_{$value}" NAME="renderer" NOTNULL="true" SEQUENCE="false" TYPE="text"/>
       </FIELDS>
       <KEYS>
-        <KEY FIELDS="id" NAME="primary" NEXT="questionidfk" TYPE="primary"/>
-        <KEY COMMENT="fk to question table" FIELDS="questionid" NAME="questionidfk" PREVIOUS="primary" REFFIELDS="id" REFTABLE="question" TYPE="foreign"/>
+        <KEY FIELDS="id" NAME="primary" TYPE="primary"/>
+        <KEY COMMENT="fk to question table" FIELDS="questionid" NAME="questionidfk" REFFIELDS="id" REFTABLE="question" TYPE="foreign"/>
       </KEYS>
     </TABLE>
-    <TABLE COMMENT="Column definitions for the question matrix" NAME="qtype_matrix_cols" NEXT="qtype_matrix_rows" PREVIOUS="qtype_matrix">
+    <TABLE COMMENT="Column definitions for the question matrix" NAME="qtype_matrix_cols">
       <FIELDS>
-        <FIELD LENGTH="10" NAME="id" NEXT="matrixid" NOTNULL="true" SEQUENCE="true" TYPE="int" UNSIGNED="true"/>
-        <FIELD COMMENT="fk to qtype_matrix table" LENGTH="10" NAME="matrixid" NEXT="shorttext" NOTNULL="true" PREVIOUS="id" SEQUENCE="false" TYPE="int" UNSIGNED="true"/>
-        <FIELD COMMENT="short word to fit in the matrix" LENGTH="small" NAME="shorttext" NEXT="description" NOTNULL="true" PREVIOUS="matrixid" SEQUENCE="false" TYPE="text"/>
-        <FIELD COMMENT="longer text to explain shorttext." LENGTH="big" NAME="description" NOTNULL="false" PREVIOUS="shorttext" SEQUENCE="false" TYPE="text"/>
+        <FIELD LENGTH="10" NAME="id" NOTNULL="true" SEQUENCE="true" TYPE="int"/>
+        <FIELD COMMENT="fk to qtype_matrix table" LENGTH="10" NAME="matrixid" NOTNULL="true" SEQUENCE="false" TYPE="int"/>
+        <FIELD COMMENT="short word to fit in the matrix" NAME="shorttext" NOTNULL="true" SEQUENCE="false" TYPE="text"/>
+        <FIELD COMMENT="longer text to explain shorttext." NAME="description" NOTNULL="false" SEQUENCE="false" TYPE="text"/>
       </FIELDS>
       <KEYS>
-        <KEY FIELDS="id" NAME="primary" NEXT="matrixidfk" TYPE="primary"/>
-        <KEY COMMENT="fk to qtype_matrix table." FIELDS="matrixid" NAME="matrixidfk" PREVIOUS="primary" REFFIELDS="id" REFTABLE="qtype_matrix" TYPE="foreign"/>
+        <KEY FIELDS="id" NAME="primary" TYPE="primary"/>
+        <KEY COMMENT="fk to qtype_matrix table." FIELDS="matrixid" NAME="matrixidfk" REFFIELDS="id" REFTABLE="qtype_matrix" TYPE="foreign"/>
       </KEYS>
     </TABLE>
-    <TABLE COMMENT="Row definitions for the question matrix" NAME="qtype_matrix_rows" NEXT="qtype_matrix_weights" PREVIOUS="qtype_matrix_cols">
+    <TABLE COMMENT="Row definitions for the question matrix" NAME="qtype_matrix_rows">
       <FIELDS>
-        <FIELD LENGTH="10" NAME="id" NEXT="matrixid" NOTNULL="true" SEQUENCE="true" TYPE="int" UNSIGNED="true"/>
-        <FIELD COMMENT="fk to qtype_matrix table" LENGTH="10" NAME="matrixid" NEXT="shorttext" NOTNULL="true" PREVIOUS="id" SEQUENCE="false" TYPE="int" UNSIGNED="true"/>
-        <FIELD COMMENT="short word to fit in the matrix" LENGTH="small" NAME="shorttext" NEXT="description" NOTNULL="true" PREVIOUS="matrixid" SEQUENCE="false" TYPE="text"/>
-        <FIELD COMMENT="longer text to explain shorttext." LENGTH="big" NAME="description" NEXT="feedback" NOTNULL="false" PREVIOUS="shorttext" SEQUENCE="false" TYPE="text"/>
-        <FIELD COMMENT="feedback." LENGTH="big" NAME="feedback" NOTNULL="false" PREVIOUS="description" SEQUENCE="false" TYPE="text"/>
+        <FIELD LENGTH="10" NAME="id" NOTNULL="true" SEQUENCE="true" TYPE="int"/>
+        <FIELD COMMENT="fk to qtype_matrix table" LENGTH="10" NAME="matrixid" NOTNULL="true" SEQUENCE="false" TYPE="int"/>
+        <FIELD COMMENT="short word to fit in the matrix" NAME="shorttext" NOTNULL="true" SEQUENCE="false" TYPE="text"/>
+        <FIELD COMMENT="longer text to explain shorttext." NAME="description" NOTNULL="false" SEQUENCE="false" TYPE="text"/>
+        <FIELD COMMENT="feedback." NAME="feedback" NOTNULL="false" SEQUENCE="false" TYPE="text"/>
       </FIELDS>
       <KEYS>
-        <KEY FIELDS="id" NAME="primary" NEXT="matrixidfk" TYPE="primary"/>
-        <KEY COMMENT="fk to qtype_matrix table." FIELDS="matrixid" NAME="matrixidfk" PREVIOUS="primary" REFFIELDS="id" REFTABLE="qtype_matrix" TYPE="foreign"/>
+        <KEY FIELDS="id" NAME="primary" TYPE="primary"/>
+        <KEY COMMENT="fk to qtype_matrix table." FIELDS="matrixid" NAME="matrixidfk" REFFIELDS="id" REFTABLE="qtype_matrix" TYPE="foreign"/>
       </KEYS>
     </TABLE>
-    <TABLE COMMENT="weightings for the cells if necessary." NAME="qtype_matrix_weights" PREVIOUS="qtype_matrix_rows">
+    <TABLE COMMENT="weightings for the cells if necessary." NAME="qtype_matrix_weights">
       <FIELDS>
-        <FIELD LENGTH="10" NAME="id" NEXT="rowid" NOTNULL="true" SEQUENCE="true" TYPE="int" UNSIGNED="true"/>
-        <FIELD COMMENT="fk to qtype_matrix_rows" LENGTH="10" NAME="rowid" NEXT="colid" NOTNULL="true" PREVIOUS="id" SEQUENCE="false" TYPE="int" UNSIGNED="true"/>
-        <FIELD COMMENT="fk to qtype_matrix_cols" LENGTH="10" NAME="colid" NEXT="weight" NOTNULL="true" PREVIOUS="rowid" SEQUENCE="false" TYPE="int" UNSIGNED="true"/>
-        <FIELD COMMENT="percentage weighting for this cell." DECIMALS="3" DEFAULT="0" LENGTH="4" NAME="weight" NOTNULL="true" PREVIOUS="colid" SEQUENCE="false" TYPE="float" UNSIGNED="false"/>
+        <FIELD LENGTH="10" NAME="id" NOTNULL="true" SEQUENCE="true" TYPE="int"/>
+        <FIELD COMMENT="fk to qtype_matrix_rows" LENGTH="10" NAME="rowid" NOTNULL="true" SEQUENCE="false" TYPE="int"/>
+        <FIELD COMMENT="fk to qtype_matrix_cols" LENGTH="10" NAME="colid" NOTNULL="true" SEQUENCE="false" TYPE="int"/>
+        <FIELD COMMENT="percentage weighting for this cell." DECIMALS="3" DEFAULT="0" LENGTH="4" NAME="weight" NOTNULL="true" SEQUENCE="false" TYPE="float"/>
       </FIELDS>
       <KEYS>
-        <KEY FIELDS="id" NAME="primary" NEXT="rowidfk" TYPE="primary"/>
-        <KEY COMMENT="fk to qtype_matrix_rows" FIELDS="rowid" NAME="rowidfk" NEXT="colidfk" PREVIOUS="primary" REFFIELDS="id" REFTABLE="qtype_matrix_rows" TYPE="foreign"/>
-        <KEY COMMENT="fk to qtype_matrix_cols" FIELDS="colid" NAME="colidfk" PREVIOUS="rowidfk" REFFIELDS="id" REFTABLE="qtype_matrix_cols" TYPE="foreign"/>
+        <KEY FIELDS="id" NAME="primary" TYPE="primary"/>
+        <KEY COMMENT="fk to qtype_matrix_rows" FIELDS="rowid" NAME="rowidfk" REFFIELDS="id" REFTABLE="qtype_matrix_rows" TYPE="foreign"/>
+        <KEY COMMENT="fk to qtype_matrix_cols" FIELDS="colid" NAME="colidfk" REFFIELDS="id" REFTABLE="qtype_matrix_cols" TYPE="foreign"/>
       </KEYS>
     </TABLE>
   </TABLES>

/var/www/moodle405/lib/tests/db/plugin_checks_test.php:58
/var/www/moodle405/lib/phpunit/classes/basic_testcase.php:64

FAILURES!
Tests: 449, Assertions: 86, Failures: 1.

Expected output: No errors.

Moodle 4.5.5+ (Build: 20250718), c97987e9ed119e45d78cd022405864445b96d7e4
Php: 8.1.28, pgsql: 16.0 (Debian 16.0-1.pgdg120+1), OS: Linux 6.8.0-64-generic x86_64
PHPUnit 9.6.18 by Sebastian Bergmann and contributors.

...............................................................  63 / 449 ( 14%)
............................................................... 126 / 449 ( 28%)
............................................................... 189 / 449 ( 42%)
............................................................... 252 / 449 ( 56%)
............................................................... 315 / 449 ( 70%)
............................................................... 378 / 449 ( 84%)
............................................................... 441 / 449 ( 98%)
........                                                        449 / 449 (100%)

Time: 00:11.483, Memory: 68.50 MB

OK (449 tests, 86 assertions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant