diff --git a/backup/moodle1/lib.php b/backup/moodle1/lib.php index 2f23a8d..a656ee0 100644 --- a/backup/moodle1/lib.php +++ b/backup/moodle1/lib.php @@ -16,7 +16,9 @@ /** * @package qtype_ddmatch - * @copyright 2011 David Mudrak + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/backup/moodle2/backup_qtype_ddmatch_plugin.class.php b/backup/moodle2/backup_qtype_ddmatch_plugin.class.php index 01c01ed..b28b60e 100644 --- a/backup/moodle2/backup_qtype_ddmatch_plugin.class.php +++ b/backup/moodle2/backup_qtype_ddmatch_plugin.class.php @@ -16,7 +16,9 @@ /** * @package qtype_ddmatch - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/backup/moodle2/restore_qtype_ddmatch_plugin.class.php b/backup/moodle2/restore_qtype_ddmatch_plugin.class.php index 20b196a..0ff04f9 100644 --- a/backup/moodle2/restore_qtype_ddmatch_plugin.class.php +++ b/backup/moodle2/restore_qtype_ddmatch_plugin.class.php @@ -16,7 +16,9 @@ /** * @package qtype_ddmatch - * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/classes/privacy/privacy.php b/classes/privacy/privacy.php index a511aaf..e72707c 100644 --- a/classes/privacy/privacy.php +++ b/classes/privacy/privacy.php @@ -18,7 +18,9 @@ * Privacy Subsystem implementation for format_tabtopics. * * @package qtype_ddmatch - * @copyright 2019 Amr Hourani + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/db/upgrade.php b/db/upgrade.php index fcac690..93ce070 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -18,7 +18,9 @@ * Drag and drop matching question type upgrade code. * * @package qtype_ddmatch - * @copyright 2007 Adriane Boyd (adrianeboyd@gmail.com) + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/db/upgradelib.php b/db/upgradelib.php index 9fb516a..f5228e7 100644 --- a/db/upgradelib.php +++ b/db/upgradelib.php @@ -18,7 +18,9 @@ * Upgrade library code for the match question type. * * @package qtype_ddmatch - * @copyright 2010 The Open University + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/edit_ddmatch_form.php b/edit_ddmatch_form.php index f2f59f9..7bdf168 100644 --- a/edit_ddmatch_form.php +++ b/edit_ddmatch_form.php @@ -18,7 +18,9 @@ * Defines the editing form for the drag&drop match question type. * * @package qtype_ddmatch - * @copyright 2007 Adriane Boyd (adrianeboyd@gmail.com) + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/lang/en/qtype_ddmatch.php b/lang/en/qtype_ddmatch.php index dc86857..5908a11 100644 --- a/lang/en/qtype_ddmatch.php +++ b/lang/en/qtype_ddmatch.php @@ -19,8 +19,10 @@ * The language strings for the match question type. * * @package qtype_ddmatch - * @copyright Adriane Boyd (adrianeboyd@gmail.com) - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['pluginname'] = 'Drag-and-Drop Matching'; @@ -31,3 +33,4 @@ $string['pluginnameadding'] = 'Adding Drag-and-Drop Matching Question'; $string['pluginnameediting'] = 'Editing Drag-and-Drop Matching Question'; $string['pluginnamesummary'] = 'An extension of the matching question that allows the user to drag and drop items to match answers to subquestions.'; +$string['privacy:metadata'] = 'The question type ddmatch plugin does not store any personal data'; diff --git a/lib.php b/lib.php index 1a5be8a..5055826 100644 --- a/lib.php +++ b/lib.php @@ -18,8 +18,10 @@ * Serve question type files * * @package qtype_ddmatch - * @author Dongsheng Cai - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); diff --git a/question.php b/question.php index c7c0270..f9a061e 100644 --- a/question.php +++ b/question.php @@ -18,7 +18,9 @@ * Drag-and-drop matching question type classe. * * @package qtype_ddmatch - * @copyright 2007 Adriane Boyd (adrianeboyd@gmail.com) + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/questiontype.php b/questiontype.php index 7ed1fc4..ca35a45 100644 --- a/questiontype.php +++ b/questiontype.php @@ -18,7 +18,9 @@ * Question type class for the drag&drop matching question type. * * @package qtype_ddmatch - * @copyright 2007 Adriane Boyd (adrianeboyd@gmail.com) + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/README.txt b/readme.md similarity index 91% rename from README.txt rename to readme.md index ce3d18e..cc49616 100644 --- a/README.txt +++ b/readme.md @@ -6,6 +6,10 @@ Installation:- Go to [ Site administration > Plugins(Plugins) > Install plugins ] and just upload or drag & drop downloaed ZIP file. To install, place all downloaded files in /question/type/ddmatch and visit /admin/index.php in your browser. +Setup:- +----- +On Course > Create new Quiz > Add Question > Drag-and-Drop Matching + Overview:- -------- The drag-and-drop question is adapted from the existing matching question. @@ -27,6 +31,10 @@ Grading:- ------- The grading is identical to the original matching question. +Requirements +------------ +* Moodle 2.4.1 - 4.1 + Uninstall --------- Admin can uninstall this admin tool from- Administration > Site Administration > Plugins > Plugins overview [Roshni Lite] > uninstall diff --git a/renderer.php b/renderer.php index c4ef642..11bad9e 100644 --- a/renderer.php +++ b/renderer.php @@ -18,6 +18,9 @@ * Drag&drop matching question renderer class. * * @package qtype_ddmatch + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/tests/behat/add.feature b/tests/behat/add.feature index 22e7802..11af8db 100644 --- a/tests/behat/add.feature +++ b/tests/behat/add.feature @@ -16,7 +16,7 @@ Feature: Test creating a drag and drop matching question | teacher1 | C1 | editingteacher | And I log in as "teacher1" And I am on "Course 1" course homepage - And I navigate to "Question bank" node in "Course administration" + And I navigate to "Question bank" in current page administration Scenario: Create a drag and drop matching question When I add a "Drag-and-Drop Matching" question filling the form with: diff --git a/tests/behat/backup_and_restore.feature b/tests/behat/backup_and_restore.feature index 8d09e3e..85fbffc 100644 --- a/tests/behat/backup_and_restore.feature +++ b/tests/behat/backup_and_restore.feature @@ -31,8 +31,8 @@ Feature: Test duplicating a quiz containing a Drag and drop matching question | Confirmation | Filename | test_backup.mbz | And I restore "test_backup.mbz" backup into a new course using this options: | Schema | Course name | Course 2 | - And I navigate to "Question bank" node in "Course administration" - And I click on "Edit" "link" in the "ddmatch-001" "table_row" + And I navigate to "Question bank" in current page administration + When I choose "Edit question" action for "ddmatch-001" in the question bank Then the following fields match these values: | Question name | ddmatch-001 | | Question text | Classify the animals. | diff --git a/tests/behat/edit.feature b/tests/behat/edit.feature index 1c596c1..e341e50 100644 --- a/tests/behat/edit.feature +++ b/tests/behat/edit.feature @@ -22,11 +22,11 @@ Feature: Test editing a Drag and drop matching question | Test questions | ddmatch | Ddmatching for editing | foursubq | And I log in as "teacher1" And I am on "Course 1" course homepage - And I navigate to "Question bank" node in "Course administration" + And I navigate to "Question bank" in current page administration @javascript @_switch_window Scenario: Edit a Drag and drop matching question - When I click on "Edit" "link" in the "Ddmatching for editing" "table_row" + When I choose "Edit question" action for "Ddmatching for editing" in the question bank And I set the following fields to these values: | Question name | | And I press "id_submitbutton" @@ -35,14 +35,14 @@ Feature: Test editing a Drag and drop matching question | Question name | Edited Ddmatching name | And I press "id_submitbutton" Then I should see "Edited Ddmatching name" - When I click on "Edit" "link" in the "Edited Ddmatching name" "table_row" + When I choose "Edit question" action for "Edited Ddmatching name" in the question bank And I set the following fields to these values: | Shuffle | 0 | | Question 2 | dog | | Question 4 | fly | And I press "id_submitbutton" Then I should see "Edited Ddmatching name" - When I click on "Preview" "link" in the "Edited Ddmatching name" "table_row" + When I choose "Preview" action for "Edited Ddmatching name" in the question bank And I switch to "questionpreview" window Then I should see "frog" And I should see "dog" diff --git a/tests/behat/export.feature b/tests/behat/export.feature index 5a64105..076fb9e 100644 --- a/tests/behat/export.feature +++ b/tests/behat/export.feature @@ -24,10 +24,11 @@ Feature: Test exporting Drag and drop matching questions And I am on "Course 1" course homepage Scenario: Export a Drag and drop matching question - When I navigate to "Export" node in "Course administration > Question bank" + When I navigate to "Question bank > Export" in current page administration + And I click on "Export" "link" And I set the field "id_format_xml" to "1" And I press "Export questions to file" - Then following "click here" should download between "1600" and "1700" bytes + Then following "click here" should download between "1000" and "5000" bytes # If the download step is the last in the scenario then we can sometimes run # into the situation where the download page causes a http redirect but behat # has already conducted its reset (generating an error). By putting a logout diff --git a/tests/behat/import.feature b/tests/behat/import.feature index e26f255..ff0797f 100644 --- a/tests/behat/import.feature +++ b/tests/behat/import.feature @@ -19,7 +19,8 @@ Feature: Test importing Drag and drop matching questions @javascript @_file_upload Scenario: import Drag and drop matching question. - When I navigate to "Import" node in "Course administration > Question bank" + When I navigate to "Question bank > Import" in current page administration + And I click on "Import" "link" And I set the field "id_format_xml" to "1" And I upload "question/type/ddmatch/tests/fixtures/qtype_sample_ddmatch.xml" file to "Import" filemanager And I press "id_submitbutton" diff --git a/tests/helper.php b/tests/helper.php index 7646241..94fc5fd 100644 --- a/tests/helper.php +++ b/tests/helper.php @@ -18,7 +18,9 @@ * Contains the helper class for the select missing words question type tests. * * @package qtype_ddmatch - * @copyright 2018 Jean-Michel Vedrine + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -90,6 +92,7 @@ public function get_ddmatch_question_data_foursubq() { $q->penalty = 0.3333333; $q->length = 1; $q->hidden = 0; + $q->idnumber = null; $q->createdby = $USER->id; $q->modifiedby = $USER->id; diff --git a/tests/question_test.php b/tests/question_test.php index 5bed70a..c85a833 100644 --- a/tests/question_test.php +++ b/tests/question_test.php @@ -19,10 +19,19 @@ * * @package qtype * @subpackage ddmatch - * @copyright 2009 The Open University + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +namespace qtype_ddmatch; + +use advanced_testcase; +use qtype_ddmatch_test_helper; +use question_attempt_step; +use question_classified_response; +use question_state; defined('MOODLE_INTERNAL') || die(); @@ -37,7 +46,7 @@ * @copyright 2009 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class qtype_ddmatch_question_test extends advanced_testcase { +class question_test extends advanced_testcase { public function test_get_expected_data() { $question = qtype_ddmatch_test_helper::make_a_ddmatching_question(); @@ -135,9 +144,9 @@ public function test_get_question_summary() { $ddmatch = qtype_ddmatch_test_helper::make_a_ddmatching_question(); $ddmatch->start_attempt(new question_attempt_step(), 1); $qsummary = $ddmatch->get_question_summary(); - $this->assertRegExp('/' . preg_quote($ddmatch->questiontext) . '/', $qsummary); + $this->assertMatchesRegularExpression('/' . preg_quote($ddmatch->questiontext, '/') . '/', $qsummary); foreach ($ddmatch->stems as $stem) { - $this->assertRegExp('/' . preg_quote($stem) . '/', $qsummary); + $this->assertMatchesRegularExpression('/' . preg_quote($stem, '/') . '/', $qsummary); } foreach ($ddmatch->choices as $choice) { $this->assertRegExp('/' . preg_quote($choice) . '/', $qsummary); @@ -151,7 +160,7 @@ public function test_summarise_response() { $summary = $ddmatch->summarise_response(array('sub0' => 2, 'sub1' => 1)); - $this->assertRegExp('/Dog -> \w+; Frog -> \w+/', $summary); + $this->assertMatchesRegularExpression('/Dog -> \w+; Frog -> \w+/', $summary); } public function test_classify_response() { diff --git a/tests/questiontype_test.php b/tests/questiontype_test.php index c1a2e14..a407a4e 100644 --- a/tests/questiontype_test.php +++ b/tests/questiontype_test.php @@ -19,10 +19,19 @@ * * @package qtype * @subpackage ddmatch - * @copyright 2009 The Open University + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +namespace qtype_ddmatch; + +use advanced_testcase; +use qtype_ddmatch; +use question_possible_response; +use stdClass; +use test_question_maker; defined('MOODLE_INTERNAL') || die(); @@ -37,15 +46,15 @@ * @copyright 2009 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class qtype_ddmatch_test extends advanced_testcase { +class questiontype_test extends advanced_testcase { /** @var qtype_ddmatch instance of the question type class to test. */ protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = new qtype_ddmatch(); } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } @@ -67,11 +76,13 @@ protected function get_test_question_data() { $q->stamp = make_unique_id_code(); $q->version = make_unique_id_code(); $q->hidden = 0; + $q->idnumber = null; $q->timecreated = time(); $q->timemodified = time(); $q->createdby = $USER->id; $q->modifiedby = $USER->id; + $q->idnumber = ''; $q->options = new stdClass(); $q->options->shuffleanswers = false; test_question_maker::set_standard_combined_feedback_fields($q->options); @@ -116,7 +127,7 @@ public function test_can_analyse_responses() { public function test_get_random_guess_score() { $q = $this->get_test_question_data(); - $this->assertEquals(0.3333333, $this->qtype->get_random_guess_score($q), '', 0.0000001); + $this->assertEqualsWithDelta(0.3333333, $this->qtype->get_random_guess_score($q), 0.0000001); } public function test_get_possible_responses() { diff --git a/tests/upgradelibnewqe_test.php b/tests/upgradelibnewqe_test.php index b692878..044f579 100644 --- a/tests/upgradelibnewqe_test.php +++ b/tests/upgradelibnewqe_test.php @@ -19,10 +19,15 @@ * ddmatch questions. * * @package qtype_ddmatch - * @copyright 2009 The Open University + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +namespace qtype_ddmatch; + +use question_attempt_upgrader_test_base; defined('MOODLE_INTERNAL') || die(); @@ -36,7 +41,7 @@ * @copyright 2009 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class qtype_ddmatch_attempt_upgrader_test extends question_attempt_upgrader_test_base { +class upgradelibnewqe_test extends question_attempt_upgrader_test_base { public function test_ddmatch_deferredfeedback_history6220() { $quiz = (object) array( diff --git a/tests/walkthrough_test.php b/tests/walkthrough_test.php index 46ae224..d87ff21 100644 --- a/tests/walkthrough_test.php +++ b/tests/walkthrough_test.php @@ -20,10 +20,19 @@ * * @package qtype * @subpackage ddmatch - * @copyright 2010 The Open University + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +namespace qtype_ddmatch; + +use qbehaviour_walkthrough_test_base; +use qtype_ddmatch_test_helper; +use question_hint_with_parts; +use question_pattern_expectation; +use question_state; defined('MOODLE_INTERNAL') || die(); @@ -37,7 +46,7 @@ * @copyright 2010 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class qtype_ddmatch_walkthrough_test extends qbehaviour_walkthrough_test_base { +class walkthrough_test extends qbehaviour_walkthrough_test_base { public function test_deferred_feedback_unanswered() { diff --git a/version.php b/version.php index c96cef9..63a2128 100644 --- a/version.php +++ b/version.php @@ -15,18 +15,21 @@ // along with Moodle. If not, see . /** + * * @package qtype_ddmatch - * @copyright 2007 Adriane Boyd (adrianeboyd@gmail.com) + * + * @author DualCube + * @copyright 2007 DualCube (https://dualcube.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'qtype_ddmatch'; -$plugin->version = 2023022200; +$plugin->version = 2023031700; $plugin->requires = 2012120301; +$plugin->maturity = MATURITY_STABLE; $plugin->dependencies = array( 'qtype_match' => 2015111600, ); -$plugin->release = '2.3 (Build: 2023021700)'; -$plugin->maturity = MATURITY_STABLE; +$plugin->release = '2.4 (Build: 2023031700)';