From 1091be842b6d04cfcd5635fd71b0ca5047d355d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20S=C3=A9bire?= Date: Wed, 5 Aug 2020 07:23:19 +0200 Subject: [PATCH 1/4] Hardcoded compilation to version 2.2. --- models/classes/class.QtiTestCompiler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/classes/class.QtiTestCompiler.php b/models/classes/class.QtiTestCompiler.php index 263a568df9..b19d810838 100755 --- a/models/classes/class.QtiTestCompiler.php +++ b/models/classes/class.QtiTestCompiler.php @@ -476,7 +476,7 @@ protected function compactTest() $resolver = new taoQtiTest_helpers_ItemResolver(Service::singleton()); $originalDoc = $testService->getDoc($test); - $compiledDoc = XmlCompactDocument::createFromXmlAssessmentTestDocument($originalDoc, $resolver, $resolver); + $compiledDoc = XmlCompactDocument::createFromXmlAssessmentTestDocument($originalDoc, $resolver, $resolver, '2.2'); common_Logger::t("QTI Test XML transformed in a compact version."); return $compiledDoc; From 6e0dc2a3785c7c56f5995be6bf57d46c7f494db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20S=C3=A9bire?= Date: Wed, 19 Aug 2020 14:05:32 +0200 Subject: [PATCH 2/4] Added QTI version as a constant. --- models/classes/class.QtiTestCompiler.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/models/classes/class.QtiTestCompiler.php b/models/classes/class.QtiTestCompiler.php index b19d810838..1fef65848b 100755 --- a/models/classes/class.QtiTestCompiler.php +++ b/models/classes/class.QtiTestCompiler.php @@ -60,6 +60,9 @@ class taoQtiTest_models_classes_QtiTestCompiler extends taoTests_models_classes_ const ADAPTIVE_PLACEHOLDER_CATEGORY = 'x-tao-qti-adaptive-placeholder'; const COMPILATION_INFO_FILENAME = 'compilation-info.json'; + + const QTI_COMPILATION_VERSION_2_2 = '2.2'; + /** * The list of mime types of files that are accepted to be put * into the public compilation directory. @@ -476,7 +479,7 @@ protected function compactTest() $resolver = new taoQtiTest_helpers_ItemResolver(Service::singleton()); $originalDoc = $testService->getDoc($test); - $compiledDoc = XmlCompactDocument::createFromXmlAssessmentTestDocument($originalDoc, $resolver, $resolver, '2.2'); + $compiledDoc = XmlCompactDocument::createFromXmlAssessmentTestDocument($originalDoc, $resolver, $resolver, self::QTI_COMPILATION_VERSION_2_2); common_Logger::t("QTI Test XML transformed in a compact version."); return $compiledDoc; From 7b88e350b24f664073bd4fd7ba3be84cbab430eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20S=C3=A9bire?= Date: Wed, 19 Aug 2020 14:09:28 +0200 Subject: [PATCH 3/4] Required extension-tao-itemqti with compilation version 2.2 and bumped version. --- manifest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.php b/manifest.php index 144595fcec..96e066349e 100755 --- a/manifest.php +++ b/manifest.php @@ -50,10 +50,10 @@ 'label' => 'QTI test model', 'description' => 'TAO QTI test implementation', 'license' => 'GPL-2.0', - 'version' => '39.6.1', + 'version' => '39.7.0', 'author' => 'Open Assessment Technologies', 'requires' => [ - 'taoQtiItem' => '>=24.0.0', + 'taoQtiItem' => '>=25.8.0', 'taoTests' => '>=14.0.0', 'tao' => '>=45.0.0', 'generis' => '>=12.20.0', From 05021b93f20e54a77438960ba3261699bb1a87a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20S=C3=A9bire?= Date: Wed, 19 Aug 2020 14:56:11 +0200 Subject: [PATCH 4/4] Added new QTI Compact versions to tests. --- .../linear_nopreconditions_branchrules.xml | 0 .../linear_nopreconditions_nobranchrules.xml | 0 .../linear_preconditions_branchrules.xml | 0 .../linear_preconditions_nobranchrules.xml | 0 .../nonlinear_nopreconditions_branchrules.xml | 0 ...onlinear_nopreconditions_nobranchrules.xml | 0 .../nonlinear_preconditions_branchrules.xml | 0 .../nonlinear_preconditions_nobranchrules.xml | 0 .../linear_nopreconditions_branchrules.xml | 85 +++++++++++++++++ .../linear_nopreconditions_nobranchrules.xml | 79 ++++++++++++++++ .../linear_preconditions_branchrules.xml | 91 +++++++++++++++++++ .../linear_preconditions_nobranchrules.xml | 85 +++++++++++++++++ .../nonlinear_nopreconditions_branchrules.xml | 85 +++++++++++++++++ ...onlinear_nopreconditions_nobranchrules.xml | 79 ++++++++++++++++ .../nonlinear_preconditions_branchrules.xml | 91 +++++++++++++++++++ .../nonlinear_preconditions_nobranchrules.xml | 85 +++++++++++++++++ .../linear_nopreconditions_branchrules.xml | 85 +++++++++++++++++ .../linear_nopreconditions_nobranchrules.xml | 79 ++++++++++++++++ .../linear_preconditions_branchrules.xml | 91 +++++++++++++++++++ .../linear_preconditions_nobranchrules.xml | 85 +++++++++++++++++ .../nonlinear_nopreconditions_branchrules.xml | 85 +++++++++++++++++ ...onlinear_nopreconditions_nobranchrules.xml | 79 ++++++++++++++++ .../nonlinear_preconditions_branchrules.xml | 91 +++++++++++++++++++ .../nonlinear_preconditions_nobranchrules.xml | 85 +++++++++++++++++ test/unit/QtiTestCompilerUtilsTest.php | 44 +++++---- 25 files changed, 1386 insertions(+), 18 deletions(-) rename test/samples/xml/compiler/meta/{ => compact_v1p0}/linear_nopreconditions_branchrules.xml (100%) rename test/samples/xml/compiler/meta/{ => compact_v1p0}/linear_nopreconditions_nobranchrules.xml (100%) rename test/samples/xml/compiler/meta/{ => compact_v1p0}/linear_preconditions_branchrules.xml (100%) rename test/samples/xml/compiler/meta/{ => compact_v1p0}/linear_preconditions_nobranchrules.xml (100%) rename test/samples/xml/compiler/meta/{ => compact_v1p0}/nonlinear_nopreconditions_branchrules.xml (100%) rename test/samples/xml/compiler/meta/{ => compact_v1p0}/nonlinear_nopreconditions_nobranchrules.xml (100%) rename test/samples/xml/compiler/meta/{ => compact_v1p0}/nonlinear_preconditions_branchrules.xml (100%) rename test/samples/xml/compiler/meta/{ => compact_v1p0}/nonlinear_preconditions_nobranchrules.xml (100%) create mode 100644 test/samples/xml/compiler/meta/compact_v2p1/linear_nopreconditions_branchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p1/linear_nopreconditions_nobranchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p1/linear_preconditions_branchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p1/linear_preconditions_nobranchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p1/nonlinear_nopreconditions_branchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p1/nonlinear_nopreconditions_nobranchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p1/nonlinear_preconditions_branchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p1/nonlinear_preconditions_nobranchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p2/linear_nopreconditions_branchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p2/linear_nopreconditions_nobranchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p2/linear_preconditions_branchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p2/linear_preconditions_nobranchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p2/nonlinear_nopreconditions_branchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p2/nonlinear_nopreconditions_nobranchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p2/nonlinear_preconditions_branchrules.xml create mode 100644 test/samples/xml/compiler/meta/compact_v2p2/nonlinear_preconditions_nobranchrules.xml diff --git a/test/samples/xml/compiler/meta/linear_nopreconditions_branchrules.xml b/test/samples/xml/compiler/meta/compact_v1p0/linear_nopreconditions_branchrules.xml similarity index 100% rename from test/samples/xml/compiler/meta/linear_nopreconditions_branchrules.xml rename to test/samples/xml/compiler/meta/compact_v1p0/linear_nopreconditions_branchrules.xml diff --git a/test/samples/xml/compiler/meta/linear_nopreconditions_nobranchrules.xml b/test/samples/xml/compiler/meta/compact_v1p0/linear_nopreconditions_nobranchrules.xml similarity index 100% rename from test/samples/xml/compiler/meta/linear_nopreconditions_nobranchrules.xml rename to test/samples/xml/compiler/meta/compact_v1p0/linear_nopreconditions_nobranchrules.xml diff --git a/test/samples/xml/compiler/meta/linear_preconditions_branchrules.xml b/test/samples/xml/compiler/meta/compact_v1p0/linear_preconditions_branchrules.xml similarity index 100% rename from test/samples/xml/compiler/meta/linear_preconditions_branchrules.xml rename to test/samples/xml/compiler/meta/compact_v1p0/linear_preconditions_branchrules.xml diff --git a/test/samples/xml/compiler/meta/linear_preconditions_nobranchrules.xml b/test/samples/xml/compiler/meta/compact_v1p0/linear_preconditions_nobranchrules.xml similarity index 100% rename from test/samples/xml/compiler/meta/linear_preconditions_nobranchrules.xml rename to test/samples/xml/compiler/meta/compact_v1p0/linear_preconditions_nobranchrules.xml diff --git a/test/samples/xml/compiler/meta/nonlinear_nopreconditions_branchrules.xml b/test/samples/xml/compiler/meta/compact_v1p0/nonlinear_nopreconditions_branchrules.xml similarity index 100% rename from test/samples/xml/compiler/meta/nonlinear_nopreconditions_branchrules.xml rename to test/samples/xml/compiler/meta/compact_v1p0/nonlinear_nopreconditions_branchrules.xml diff --git a/test/samples/xml/compiler/meta/nonlinear_nopreconditions_nobranchrules.xml b/test/samples/xml/compiler/meta/compact_v1p0/nonlinear_nopreconditions_nobranchrules.xml similarity index 100% rename from test/samples/xml/compiler/meta/nonlinear_nopreconditions_nobranchrules.xml rename to test/samples/xml/compiler/meta/compact_v1p0/nonlinear_nopreconditions_nobranchrules.xml diff --git a/test/samples/xml/compiler/meta/nonlinear_preconditions_branchrules.xml b/test/samples/xml/compiler/meta/compact_v1p0/nonlinear_preconditions_branchrules.xml similarity index 100% rename from test/samples/xml/compiler/meta/nonlinear_preconditions_branchrules.xml rename to test/samples/xml/compiler/meta/compact_v1p0/nonlinear_preconditions_branchrules.xml diff --git a/test/samples/xml/compiler/meta/nonlinear_preconditions_nobranchrules.xml b/test/samples/xml/compiler/meta/compact_v1p0/nonlinear_preconditions_nobranchrules.xml similarity index 100% rename from test/samples/xml/compiler/meta/nonlinear_preconditions_nobranchrules.xml rename to test/samples/xml/compiler/meta/compact_v1p0/nonlinear_preconditions_nobranchrules.xml diff --git a/test/samples/xml/compiler/meta/compact_v2p1/linear_nopreconditions_branchrules.xml b/test/samples/xml/compiler/meta/compact_v2p1/linear_nopreconditions_branchrules.xml new file mode 100644 index 0000000000..d0b17a2253 --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p1/linear_nopreconditions_branchrules.xml @@ -0,0 +1,85 @@ + + + + + + + + true + true + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p1/linear_nopreconditions_nobranchrules.xml b/test/samples/xml/compiler/meta/compact_v2p1/linear_nopreconditions_nobranchrules.xml new file mode 100644 index 0000000000..ed6474fbd4 --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p1/linear_nopreconditions_nobranchrules.xml @@ -0,0 +1,79 @@ + + + + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p1/linear_preconditions_branchrules.xml b/test/samples/xml/compiler/meta/compact_v2p1/linear_preconditions_branchrules.xml new file mode 100644 index 0000000000..bd8c0e1e6b --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p1/linear_preconditions_branchrules.xml @@ -0,0 +1,91 @@ + + + + + + + + true + true + + + + + true + true + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p1/linear_preconditions_nobranchrules.xml b/test/samples/xml/compiler/meta/compact_v2p1/linear_preconditions_nobranchrules.xml new file mode 100644 index 0000000000..b5086a867a --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p1/linear_preconditions_nobranchrules.xml @@ -0,0 +1,85 @@ + + + + + + + + true + true + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p1/nonlinear_nopreconditions_branchrules.xml b/test/samples/xml/compiler/meta/compact_v2p1/nonlinear_nopreconditions_branchrules.xml new file mode 100644 index 0000000000..c49fbb726f --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p1/nonlinear_nopreconditions_branchrules.xml @@ -0,0 +1,85 @@ + + + + + + + + true + true + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p1/nonlinear_nopreconditions_nobranchrules.xml b/test/samples/xml/compiler/meta/compact_v2p1/nonlinear_nopreconditions_nobranchrules.xml new file mode 100644 index 0000000000..e192ddcf17 --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p1/nonlinear_nopreconditions_nobranchrules.xml @@ -0,0 +1,79 @@ + + + + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p1/nonlinear_preconditions_branchrules.xml b/test/samples/xml/compiler/meta/compact_v2p1/nonlinear_preconditions_branchrules.xml new file mode 100644 index 0000000000..452cf2f517 --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p1/nonlinear_preconditions_branchrules.xml @@ -0,0 +1,91 @@ + + + + + + + + true + true + + + + + true + true + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p1/nonlinear_preconditions_nobranchrules.xml b/test/samples/xml/compiler/meta/compact_v2p1/nonlinear_preconditions_nobranchrules.xml new file mode 100644 index 0000000000..6c1a3ec83e --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p1/nonlinear_preconditions_nobranchrules.xml @@ -0,0 +1,85 @@ + + + + + + + + true + true + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p2/linear_nopreconditions_branchrules.xml b/test/samples/xml/compiler/meta/compact_v2p2/linear_nopreconditions_branchrules.xml new file mode 100644 index 0000000000..20e10a76d1 --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p2/linear_nopreconditions_branchrules.xml @@ -0,0 +1,85 @@ + + + + + + + + true + true + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p2/linear_nopreconditions_nobranchrules.xml b/test/samples/xml/compiler/meta/compact_v2p2/linear_nopreconditions_nobranchrules.xml new file mode 100644 index 0000000000..056b82edfb --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p2/linear_nopreconditions_nobranchrules.xml @@ -0,0 +1,79 @@ + + + + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p2/linear_preconditions_branchrules.xml b/test/samples/xml/compiler/meta/compact_v2p2/linear_preconditions_branchrules.xml new file mode 100644 index 0000000000..a89b7c0c44 --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p2/linear_preconditions_branchrules.xml @@ -0,0 +1,91 @@ + + + + + + + + true + true + + + + + true + true + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p2/linear_preconditions_nobranchrules.xml b/test/samples/xml/compiler/meta/compact_v2p2/linear_preconditions_nobranchrules.xml new file mode 100644 index 0000000000..4e88ff4218 --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p2/linear_preconditions_nobranchrules.xml @@ -0,0 +1,85 @@ + + + + + + + + true + true + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p2/nonlinear_nopreconditions_branchrules.xml b/test/samples/xml/compiler/meta/compact_v2p2/nonlinear_nopreconditions_branchrules.xml new file mode 100644 index 0000000000..36b5fbbc5a --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p2/nonlinear_nopreconditions_branchrules.xml @@ -0,0 +1,85 @@ + + + + + + + + true + true + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p2/nonlinear_nopreconditions_nobranchrules.xml b/test/samples/xml/compiler/meta/compact_v2p2/nonlinear_nopreconditions_nobranchrules.xml new file mode 100644 index 0000000000..d14be87557 --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p2/nonlinear_nopreconditions_nobranchrules.xml @@ -0,0 +1,79 @@ + + + + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p2/nonlinear_preconditions_branchrules.xml b/test/samples/xml/compiler/meta/compact_v2p2/nonlinear_preconditions_branchrules.xml new file mode 100644 index 0000000000..f4096a1b89 --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p2/nonlinear_preconditions_branchrules.xml @@ -0,0 +1,91 @@ + + + + + + + + true + true + + + + + true + true + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/samples/xml/compiler/meta/compact_v2p2/nonlinear_preconditions_nobranchrules.xml b/test/samples/xml/compiler/meta/compact_v2p2/nonlinear_preconditions_nobranchrules.xml new file mode 100644 index 0000000000..21d08371e3 --- /dev/null +++ b/test/samples/xml/compiler/meta/compact_v2p2/nonlinear_preconditions_nobranchrules.xml @@ -0,0 +1,85 @@ + + + + + + + + true + true + + + + + ChoiceA + + + + + 0 + + + + + + + + + ChoiceB + + + + + 0 + + + + + + + + + ChoiceC + + + + + 0 + + + + + + + + + ChoiceD + + + + + 0 + + + + + + + + + ChoiceE + + + + + 0 + + + + + + + diff --git a/test/unit/QtiTestCompilerUtilsTest.php b/test/unit/QtiTestCompilerUtilsTest.php index 7c0e146792..24d0ce19c5 100644 --- a/test/unit/QtiTestCompilerUtilsTest.php +++ b/test/unit/QtiTestCompilerUtilsTest.php @@ -22,8 +22,8 @@ namespace oat\taoQtiTest\test\unit; use oat\generis\test\TestCase; -use \taoQtiTest_helpers_TestCompilerUtils; -use \qtism\data\storage\xml\XmlDocument; +use qtism\data\storage\xml\XmlDocument; +use taoQtiTest_helpers_TestCompilerUtils; /** * This test case focuses on testing the TestCompilerUtils helper. @@ -34,12 +34,11 @@ */ class QtiTestCompilerUtilsTest extends TestCase { - - public static function samplesDir() + public static function samplesDir($version) { - return dirname(__FILE__) . '/../samples/xml/compiler/meta/'; + return __DIR__ . '/../samples/xml/compiler/meta/compact_' . $version . '/'; } - + /** * * @dataProvider metaProvider @@ -50,21 +49,30 @@ public function testTestMeta($testFile, $expectedMeta) { $xml = new XmlDocument(); $xml->load($testFile); - + $this->assertEquals($expectedMeta, taoQtiTest_helpers_TestCompilerUtils::testMeta($xml->getDocumentComponent())); } - + public function metaProvider() { - return [ - [self::samplesDir() . 'linear_nopreconditions_nobranchrules.xml', ['branchRules' => false, 'preConditions' => false]], - [self::samplesDir() . 'linear_preconditions_nobranchrules.xml', ['branchRules' => false, 'preConditions' => true]], - [self::samplesDir() . 'linear_nopreconditions_branchrules.xml', ['branchRules' => true, 'preConditions' => false]], - [self::samplesDir() . 'linear_preconditions_branchrules.xml', ['branchRules' => true, 'preConditions' => true]], - [self::samplesDir() . 'nonlinear_nopreconditions_nobranchrules.xml', ['branchRules' => false, 'preConditions' => false]], - [self::samplesDir() . 'nonlinear_nopreconditions_branchrules.xml', ['branchRules' => false, 'preConditions' => false]], - [self::samplesDir() . 'nonlinear_preconditions_branchrules.xml', ['branchRules' => false, 'preConditions' => false]], - [self::samplesDir() . 'nonlinear_preconditions_nobranchrules.xml', ['branchRules' => false, 'preConditions' => false]], - ]; + $versions = ['v1p0', 'v2p1', 'v2p2']; + $sets = []; + + foreach ($versions as $version) { + $sets = array_merge($sets, + [ + [self::samplesDir($version) . 'linear_nopreconditions_nobranchrules.xml', ['branchRules' => false, 'preConditions' => false]], + [self::samplesDir($version) . 'linear_preconditions_nobranchrules.xml', ['branchRules' => false, 'preConditions' => true]], + [self::samplesDir($version) . 'linear_nopreconditions_branchrules.xml', ['branchRules' => true, 'preConditions' => false]], + [self::samplesDir($version) . 'linear_preconditions_branchrules.xml', ['branchRules' => true, 'preConditions' => true]], + [self::samplesDir($version) . 'nonlinear_nopreconditions_nobranchrules.xml', ['branchRules' => false, 'preConditions' => false]], + [self::samplesDir($version) . 'nonlinear_nopreconditions_branchrules.xml', ['branchRules' => false, 'preConditions' => false]], + [self::samplesDir($version) . 'nonlinear_preconditions_branchrules.xml', ['branchRules' => false, 'preConditions' => false]], + [self::samplesDir($version) . 'nonlinear_preconditions_nobranchrules.xml', ['branchRules' => false, 'preConditions' => false]], + ] + ); + } + + return $sets; } }