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', diff --git a/models/classes/class.QtiTestCompiler.php b/models/classes/class.QtiTestCompiler.php index 263a568df9..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); + $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; 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; } }