Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-37600 qtype match: fix codechecker issues.

  • Loading branch information...
commit 9887aaeb75f81476405ab178cc31dc000f95d292 1 parent 87d7673
@timhunt timhunt authored
View
22 question/type/match/backup/moodle1/lib.php
@@ -1,5 +1,4 @@
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -16,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package qtype
- * @subpackage match
+ * @package qtype_match
* @copyright 2011 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -25,7 +23,7 @@
defined('MOODLE_INTERNAL') || die();
/**
- * Matching question type conversion handler
+ * Matching question type conversion handler.
*/
class moodle1_qtype_match_handler extends moodle1_qtype_handler {
@@ -35,19 +33,19 @@ class moodle1_qtype_match_handler extends moodle1_qtype_handler {
public function get_question_subpaths() {
return array(
'MATCHOPTIONS',
- 'MATCHS/MATCH'
+ 'MATCHS/MATCH',
);
}
/**
- * Appends the match specific information to the question
+ * Appends the match specific information to the question.
*/
public function process_question(array $data, array $raw) {
global $CFG;
- // populate the list of matches first to get their ids
- // note that the field is re-populated on restore anyway but let us
- // do our best to produce valid backup files
+ // Populate the list of matches first to get their ids.
+ // Note that the field is re-populated on restore anyway but let us
+ // do our best to produce valid backup files.
$matchids = array();
if (isset($data['matchs']['match'])) {
foreach ($data['matchs']['match'] as $match) {
@@ -55,7 +53,7 @@ public function process_question(array $data, array $raw) {
}
}
- // convert match options
+ // Convert match options.
if (isset($data['matchoptions'])) {
$matchoptions = $data['matchoptions'][0];
} else {
@@ -65,11 +63,11 @@ public function process_question(array $data, array $raw) {
$matchoptions['subquestions'] = implode(',', $matchids);
$this->write_xml('matchoptions', $matchoptions, array('/matchoptions/id'));
- // convert matches
+ // Convert matches.
$this->xmlwriter->begin_tag('matches');
if (isset($data['matchs']['match'])) {
foreach ($data['matchs']['match'] as $match) {
- // replay the upgrade step 2009072100
+ // Replay the upgrade step 2009072100.
$match['questiontextformat'] = 0;
if ($CFG->texteditors !== 'textarea' and $data['oldquestiontextformat'] == FORMAT_MOODLE) {
$match['questiontext'] = text_to_html($match['questiontext'], false, false, true);
View
20 question/type/match/backup/moodle2/backup_qtype_match_plugin.class.php
@@ -26,7 +26,7 @@
/**
- * Provides the information to backup match questions
+ * Provides the information to backup match questions.
*
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -34,20 +34,20 @@
class backup_qtype_match_plugin extends backup_qtype_plugin {
/**
- * Returns the qtype information to attach to question element
+ * Returns the qtype information to attach to question element.
*/
protected function define_question_plugin_structure() {
- // Define the virtual plugin element with the condition to fulfill
+ // Define the virtual plugin element with the condition to fulfill.
$plugin = $this->get_plugin_element(null, '../../qtype', 'match');
- // Create one standard named plugin element (the visible container)
+ // Create one standard named plugin element (the visible container).
$pluginwrapper = new backup_nested_element($this->get_recommended_name());
- // connect the visible container ASAP
+ // Connect the visible container ASAP.
$plugin->add_child($pluginwrapper);
- // Now create the qtype own structures
+ // Now create the qtype own structures.
$matchoptions = new backup_nested_element('matchoptions', array('id'), array(
'shuffleanswers', 'correctfeedback', 'correctfeedbackformat',
'partiallycorrectfeedback', 'partiallycorrectfeedbackformat',
@@ -58,12 +58,12 @@ protected function define_question_plugin_structure() {
$match = new backup_nested_element('match', array('id'), array(
'questiontext', 'questiontextformat', 'answertext'));
- // Now the own qtype tree
+ // Now the own qtype tree.
$pluginwrapper->add_child($matchoptions);
$pluginwrapper->add_child($matches);
$matches->add_child($match);
- // set source to populate the data
+ // Set source to populate the data.
$matchoptions->set_source_table('qtype_match_options',
array('questionid' => backup::VAR_PARENTID));
$match->set_source_sql('
@@ -73,13 +73,13 @@ protected function define_question_plugin_structure() {
ORDER BY id',
array('questionid' => backup::VAR_PARENTID));
- // don't need to annotate ids nor files
+ // Don't need to annotate ids nor files.
return $plugin;
}
/**
- * Returns one array with filearea => mappingname elements for the qtype
+ * Returns one array with filearea => mappingname elements for the qtype.
*
* Used by {@link get_components_and_fileareas} to know about all the qtype
* files to be processed both in backup and restore.
View
45 question/type/match/backup/moodle2/restore_qtype_match_plugin.class.php
@@ -26,8 +26,8 @@
/**
- * restore plugin class that provides the necessary information
- * needed to restore one match qtype plugin
+ * Restore plugin class that provides the necessary information
+ * needed to restore one match qtype plugin.
*
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -35,13 +35,13 @@
class restore_qtype_match_plugin extends restore_qtype_plugin {
/**
- * Returns the paths to be handled by the plugin at question level
+ * Returns the paths to be handled by the plugin at question level.
*/
protected function define_question_plugin_structure() {
$paths = array();
- // Add own qtype stuff
+ // Add own qtype stuff.
$elename = 'matchoptions';
// We used get_recommended_name() so this works.
$elepath = $this->get_pathfor('/matchoptions');
@@ -52,7 +52,7 @@ protected function define_question_plugin_structure() {
$elepath = $this->get_pathfor('/matches/match');
$paths[] = new restore_path_element($elename, $elepath);
- return $paths; // And we return the interesting paths
+ return $paths;
}
/**
@@ -64,12 +64,12 @@ public function process_matchoptions($data) {
$data = (object)$data;
$oldid = $data->id;
- // Detect if the question is created or mapped
+ // Detect if the question is created or mapped.
$oldquestionid = $this->get_old_parentid('question');
$newquestionid = $this->get_new_parentid('question');
$questioncreated = $this->get_mappingid('question_created', $oldquestionid) ? true : false;
- // If the question has been created by restore, we need to create its qtype_match_options too
+ // If the question has been created by restore, we need to create its qtype_match_options too.
if ($questioncreated) {
// Fill in some field that were added in 2.1, and so which may be missing
// from backups made in older versions of Moodle.
@@ -89,7 +89,7 @@ public function process_matchoptions($data) {
$data->shownumcorrect = 0;
}
- // Adjust some columns
+ // Adjust some columns.
$data->questionid = $newquestionid;
$newitemid = $DB->insert_record('qtype_match_options', $data);
$this->set_mapping('qtype_match_options', $oldid, $newitemid);
@@ -105,7 +105,7 @@ public function process_match($data) {
$data = (object)$data;
$oldid = $data->id;
- // Detect if the question is created or mapped
+ // Detect if the question is created or mapped.
$oldquestionid = $this->get_old_parentid('question');
$newquestionid = $this->get_new_parentid('question');
$questioncreated = $this->get_mappingid('question_created', $oldquestionid) ? true : false;
@@ -114,21 +114,21 @@ public function process_match($data) {
// If the question has been created by restore, we need to create its
// qtype_match_subquestions too.
- // Adjust some columns
+ // Adjust some columns.
$data->questionid = $newquestionid;
- // Insert record
+ // Insert record.
$newitemid = $DB->insert_record('qtype_match_subquestions', $data);
- // Create mapping (there are files and states based on this)
+ // Create mapping (there are files and states based on this).
$this->set_mapping('qtype_match_subquestions', $oldid, $newitemid);
if (isset($data->code)) {
$this->set_mapping('qtype_match_subquestion_codes', $data->code, $newitemid);
}
} else {
- // match questions require mapping of qtype_match_subquestions, because
- // they are used by question_states->answer
+ // Match questions require mapping of qtype_match_subquestions, because
+ // they are used by question_states->answer.
- // Look for matching subquestion (by questionid, questiontext and answertext)
+ // Look for matching subquestion (by questionid, questiontext and answertext).
$sub = $DB->get_record_select('qtype_match_subquestions', 'questionid = ? AND ' .
$DB->sql_compare_text('questiontext') . ' = ' .
$DB->sql_compare_text('?').' AND answertext = ?',
@@ -138,13 +138,16 @@ public function process_match($data) {
// Not able to find the answer, let's try cleaning the answertext
// of all the match subquestions in DB as slower fallback. MDL-36683 / MDL-30018.
if (!$sub) {
- $potentialsubs = $DB->get_records('qtype_match_subquestions', array('questionid' => $newquestionid), '', 'id, questiontext, answertext');
+ $potentialsubs = $DB->get_records('qtype_match_subquestions',
+ array('questionid' => $newquestionid), '', 'id, questiontext, answertext');
foreach ($potentialsubs as $potentialsub) {
// Clean in the same way than {@link xml_writer::xml_safe_utf8()}.
- $cleanquestion = preg_replace('/[\x-\x8\xb-\xc\xe-\x1f\x7f]/is', '', $potentialsub->questiontext); // Clean CTRL chars.
+ $cleanquestion = preg_replace('/[\x-\x8\xb-\xc\xe-\x1f\x7f]/is',
+ '', $potentialsub->questiontext); // Clean CTRL chars.
$cleanquestion = preg_replace("/\r\n|\r/", "\n", $cleanquestion); // Normalize line ending.
- $cleananswer = preg_replace('/[\x-\x8\xb-\xc\xe-\x1f\x7f]/is', '', $potentialsub->answertext); // Clean CTRL chars.
+ $cleananswer = preg_replace('/[\x-\x8\xb-\xc\xe-\x1f\x7f]/is',
+ '', $potentialsub->answertext); // Clean CTRL chars.
$cleananswer = preg_replace("/\r\n|\r/", "\n", $cleananswer); // Normalize line ending.
if ($cleanquestion === $data->questiontext && $cleananswer == $data->answertext) {
@@ -153,7 +156,7 @@ public function process_match($data) {
}
}
- // Found, let's create the mapping
+ // Found one. Let's create the mapping.
if ($sub) {
$this->set_mapping('qtype_match_subquestions', $oldid, $sub->id);
} else {
@@ -174,7 +177,7 @@ public function recode_response($questionid, $sequencenumber, array $response) {
/**
* Given one question_states record, return the answer
- * recoded pointing to all the restored stuff for match questions
+ * recoded pointing to all the restored stuff for match questions.
*
* answer is one comma separated list of hypen separated pairs
* containing question_match_sub->id and question_match_sub->code, which
@@ -214,7 +217,7 @@ protected function recode_match_sub_order($order) {
}
/**
- * Return the contents of this qtype to be processed by the links decoder
+ * Return the contents of this qtype to be processed by the links decoder.
*/
public static function define_decode_contents() {
View
7 question/type/match/db/upgrade.php
@@ -17,10 +17,9 @@
/**
* Matching question type upgrade code.
*
- * @package qtype
- * @subpackage match
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package qtype_match
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
View
11 question/type/match/db/upgradelib.php
@@ -17,10 +17,9 @@
/**
* Upgrade library code for the match question type.
*
- * @package qtype
- * @subpackage match
- * @copyright 2010 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package qtype_match
+ * @copyright 2010 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -33,8 +32,8 @@
*
* This class is used by the code in question/engine/upgrade/upgradelib.php.
*
- * @copyright 2010 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 2010 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_match_qe2_attempt_updater extends question_qtype_attempt_updater {
protected $stems;
View
24 question/type/match/edit_match_form.php
@@ -17,10 +17,9 @@
/**
* Defines the editing form for the match question type.
*
- * @package qtype
- * @subpackage match
- * @copyright 2007 Jamie Pratt me@jamiep.org
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package qtype_match
+ * @copyright 2007 Jamie Pratt me@jamiep.org
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -30,8 +29,8 @@
/**
* Match question type editing form definition.
*
- * @copyright 2007 Jamie Pratt me@jamiep.org
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 2007 Jamie Pratt me@jamiep.org
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_match_edit_form extends question_edit_form {
@@ -88,15 +87,10 @@ protected function data_preprocessing($question) {
$draftid = file_get_submitted_draft_itemid('subquestions[' . $key . ']');
$question->subquestions[$key] = array();
- $question->subquestions[$key]['text'] = file_prepare_draft_area(
- $draftid, // draftid
- $this->context->id, // context
- 'qtype_match', // component
- 'subquestion', // filarea
- !empty($subquestion->id) ? (int) $subquestion->id : null, // itemid
- $this->fileoptions, // options
- $subquestion->questiontext // text
- );
+ $question->subquestions[$key]['text'] = file_prepare_draft_area($draftid,
+ $this->context->id, 'qtype_match', 'subquestion',
+ !empty($subquestion->id) ? (int) $subquestion->id : null,
+ $this->fileoptions, $subquestion->questiontext);
$question->subquestions[$key]['format'] = $subquestion->questiontextformat;
$question->subquestions[$key]['itemid'] = $draftid;
$key++;
View
7 question/type/match/lang/en/qtype_match.php
@@ -17,10 +17,9 @@
/**
* Strings for component 'qtype_match', language 'en', branch 'MOODLE_20_STABLE'
*
- * @package qtype
- * @subpackage match
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package qtype_match
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['addmoreqblanks'] = '{no} More Sets of Blanks';
View
13 question/type/match/question.php
@@ -17,10 +17,9 @@
/**
* Matching question definition class.
*
- * @package qtype
- * @subpackage match
- * @copyright 2009 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package qtype_match
+ * @copyright 2009 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -30,8 +29,8 @@
/**
* Represents a matching question.
*
- * @copyright 2009 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 2009 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_match_question extends question_graded_automatically_with_countback {
/** @var boolean Whether the question stems should be shuffled. */
@@ -273,7 +272,7 @@ public function get_choice_order() {
public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload) {
if ($component == 'qtype_match' && $filearea == 'subquestion') {
- $subqid = reset($args); // itemid is sub question id
+ $subqid = reset($args); // Itemid is sub question id.
return array_key_exists($subqid, $this->stems);
} else if ($component == 'question' && in_array($filearea,
View
4 question/type/match/questiontype.php
@@ -55,7 +55,7 @@ public function save_question_options($question) {
$oldsubquestions = $DB->get_records('qtype_match_subquestions',
array('questionid' => $question->id), 'id ASC');
- // Insert all the new question+answer pairs
+ // Insert all the new question & answer pairs.
foreach ($question->subquestions as $key => $questiontext) {
if ($questiontext['text'] == '' && trim($question->subanswers[$key]) == '') {
continue;
@@ -82,7 +82,7 @@ public function save_question_options($question) {
$DB->update_record('qtype_match_subquestions', $subquestion);
}
- // Delete old subquestions records
+ // Delete old subquestions records.
$fs = get_file_storage();
foreach ($oldsubquestions as $oldsub) {
$fs->delete_area_files($context->id, 'qtype_match', 'subquestion', $oldsub->id);
View
17 question/type/match/renderer.php
@@ -17,10 +17,9 @@
/**
* Matching question renderer class.
*
- * @package qtype
- * @subpackage match
- * @copyright 2009 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package qtypematch
+ * @copyright 2009 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -30,8 +29,8 @@
/**
* Generates the output for matching questions.
*
- * @copyright 2009 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 2009 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_match_renderer extends qtype_with_combined_feedback_renderer {
@@ -81,7 +80,9 @@ public function formulation_and_controls(question_attempt $qa,
}
$result .= html_writer::tag('td',
- html_writer::label(get_string('answer', 'qtype_match', $i), 'menu' . $qa->get_qt_field_name('sub' . $key), false, array('class' => 'accesshide')) .
+ html_writer::label(get_string('answer', 'qtype_match', $i),
+ 'menu' . $qa->get_qt_field_name('sub' . $key), false,
+ array('class' => 'accesshide')) .
html_writer::select($choices, $qa->get_qt_field_name('sub' . $key), $selected,
array('0' => 'choose'), array('disabled' => $options->readonly)) .
' ' . $feedbackimage, array('class' => $classes));
@@ -93,7 +94,7 @@ public function formulation_and_controls(question_attempt $qa,
$result .= html_writer::end_tag('tbody');
$result .= html_writer::end_tag('table');
- $result .= html_writer::end_tag('div'); // ablock
+ $result .= html_writer::end_tag('div'); // Closes <div class="ablock">.
if ($qa->get_state() == question_state::$invalid) {
$result .= html_writer::nonempty_tag('div',
View
11 question/type/match/tests/question_test.php
@@ -17,10 +17,9 @@
/**
* Unit tests for the matching question definition classes.
*
- * @package qtype
- * @subpackage match
- * @copyright 2009 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package qtype_match
+ * @copyright 2009 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -33,8 +32,8 @@
/**
* Unit tests for the matching question definition class.
*
- * @copyright 2009 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 2009 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_match_question_test extends advanced_testcase {
View
11 question/type/match/tests/questiontype_test.php
@@ -17,10 +17,9 @@
/**
* Unit tests for the matching question definition class.
*
- * @package qtype
- * @subpackage match
- * @copyright 2009 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package qtype_match
+ * @copyright 2009 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -34,8 +33,8 @@
/**
* Unit tests for the matching question definition class.
*
- * @copyright 2009 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 2009 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_match_test extends advanced_testcase {
/** @var qtype_match instance of the question type class to test. */
View
101 question/type/match/tests/upgradelibnewqe_test.php
@@ -18,10 +18,9 @@
* Tests of the upgrade to the new Moodle question engine for attempts at
* match questions.
*
- * @package qtype
- * @subpackage match
- * @copyright 2009 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package qtype_match
+ * @copyright 2009 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -34,8 +33,8 @@
/**
* Testing the upgrade of match question attempts.
*
- * @copyright 2009 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 2009 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_match_attempt_upgrader_test extends question_attempt_upgrader_test_base {
@@ -226,9 +225,24 @@ public function test_match_deferredfeedback_history6220() {
'maxmark' => 3,
'minfraction' => 0,
'flagged' => 0,
- 'questionsummary' => 'Associate the appropriate definition with each term. {Active adjacent system; Autonomous adjacent system; Cooperative adjacent system} -> {A system that interacts with or participates in the work.; An external entity that acts independently of the work under study.; A system that is involved in the response to a business event.; A system which does not supply or receive data from the work.; An external entity that performs part of the work under study.}',
- 'rightanswer' => 'Active adjacent system -> A system that interacts with or participates in the work.; Autonomous adjacent system -> An external entity that acts independently of the work under study.; Cooperative adjacent system -> A system that is involved in the response to a business event.',
- 'responsesummary' => 'Active adjacent system -> A system that interacts with or participates in the work.; Autonomous adjacent system -> An external entity that acts independently of the work under study.; Cooperative adjacent system -> A system that is involved in the response to a business event.',
+ 'questionsummary' => 'Associate the appropriate definition with each term. ' .
+ '{Active adjacent system; Autonomous adjacent system; ' .
+ 'Cooperative adjacent system} -> {A system that interacts with ' .
+ 'or participates in the work.; An external entity that acts ' .
+ 'independently of the work under study.; A system that is involved ' .
+ 'in the response to a business event.; A system which does not supply ' .
+ 'or receive data from the work.; An external entity that performs part ' .
+ 'of the work under study.}',
+ 'rightanswer' => 'Active adjacent system -> A system that interacts with ' .
+ 'or participates in the work.; Autonomous adjacent system -> ' .
+ 'An external entity that acts independently of the work under study.; ' .
+ 'Cooperative adjacent system -> A system that is involved in the response ' .
+ 'to a business event.',
+ 'responsesummary' => 'Active adjacent system -> A system that interacts with ' .
+ 'or participates in the work.; Autonomous adjacent system -> ' .
+ 'An external entity that acts independently of the work under study.; ' .
+ 'Cooperative adjacent system -> A system that is involved in the response ' .
+ 'to a business event.',
'timemodified' => 1177419956,
'steps' => array(
0 => (object) array(
@@ -237,7 +251,8 @@ public function test_match_deferredfeedback_history6220() {
'fraction' => null,
'timecreated' => 1177419915,
'userid' => 91483,
- 'data' => array('_stemorder' => '148,149,150', '_choiceorder' => 'todo - see below'),
+ 'data' => array('_stemorder' => '148,149,150',
+ '_choiceorder' => 'todo - see below'),
),
1 => (object) array(
'sequencenumber' => 1,
@@ -266,7 +281,7 @@ public function test_match_deferredfeedback_history6220() {
),
);
- // This is a random thing, so just set expected to actual:
+ // This is a random thing, so just set expected to actual.
$expectedqa->steps[0]->data['_choiceorder'] = $qa->steps[0]->data['_choiceorder'];
$order = explode(',', $qa->steps[0]->data['_choiceorder']);
$order = array_combine(array_values($order), array_keys($order));
@@ -285,7 +300,8 @@ public function test_match_deferredfeedback_history60() {
'id' => '60',
'course' => '2304',
'name' => 'Types of resources available quiz',
- 'intro' => 'This quiz covers the different types of information resources available and how to select which is most appropriate. ',
+ 'intro' => 'This quiz covers the different types of information resources available ' .
+ 'and how to select which is most appropriate. ',
'introformat' => FORMAT_HTML,
'questiondecimalpoints' => '-1',
'showuserpicture' => '1',
@@ -377,7 +393,8 @@ public function test_match_deferredfeedback_history60() {
),
216 => (object) array(
'questionid' => '738',
- 'questiontext' => 'Subject gateways can provide a more direct route to websites containing academic content ',
+ 'questiontext' => 'Subject gateways can provide a more direct route ' .
+ 'to websites containing academic content ',
'answertext' => 'True',
'id' => 216,
),
@@ -439,9 +456,21 @@ public function test_match_deferredfeedback_history60() {
'maxmark' => 1,
'minfraction' => 0,
'flagged' => 0,
- 'questionsummary' => 'Which of the following statements about subject gateways are true, and which are false? {Subject gateways provide links to sites that have been quality checked; Subject gateways offer more variety than search engines; Subject gateways index websites automatically; Subject gateways can provide a more direct route to websites containing academic content} -> {True; False}',
- 'rightanswer' => 'Subject gateways provide links to sites that have been quality checked -> True; Subject gateways offer more variety than search engines -> False; Subject gateways index websites automatically -> False; Subject gateways can provide a more direct route to websites containing academic content -> True',
- 'responsesummary' => 'Subject gateways provide links to sites that have been quality checked -> True; Subject gateways offer more variety than search engines -> False; Subject gateways index websites automatically -> False; Subject gateways can provide a more direct route to websites containing academic content -> True',
+ 'questionsummary' => 'Which of the following statements about subject ' .
+ 'gateways are true, and which are false? {Subject gateways ' .
+ 'provide links to sites that have been quality checked; ' .
+ 'Subject gateways offer more variety than search engines; ' .
+ 'Subject gateways index websites automatically; ' .
+ 'Subject gateways can provide a more direct route to websites containing academic content} -> ' .
+ '{True; False}',
+ 'rightanswer' => 'Subject gateways provide links to sites that have been quality checked -> True; ' .
+ 'Subject gateways offer more variety than search engines -> False; ' .
+ 'Subject gateways index websites automatically -> False; ' .
+ 'Subject gateways can provide a more direct route to websites containing academic content -> True',
+ 'responsesummary' => 'Subject gateways provide links to sites that have been quality checked -> True; ' .
+ 'Subject gateways offer more variety than search engines -> False; ' .
+ 'Subject gateways index websites automatically -> False; ' .
+ 'Subject gateways can provide a more direct route to websites containing academic content -> True',
'timemodified' => 1168267508,
'steps' => array(
0 => (object) array(
@@ -458,12 +487,12 @@ public function test_match_deferredfeedback_history60() {
'fraction' => 1,
'timecreated' => 1168267508,
'userid' => 182682,
- 'data' => array('sub0' => 213, 'sub1' => 214,'sub2' => 214,'sub3' => 213, '-finish' => 1),
+ 'data' => array('sub0' => 213, 'sub1' => 214, 'sub2' => 214, 'sub3' => 213, '-finish' => 1),
),
),
);
- // This is a random thing, so just set expected to actual:
+ // This is a random thing, so just set expected to actual.
$expectedqa->steps[0]->data['_choiceorder'] = $qa->steps[0]->data['_choiceorder'];
$order = explode(',', $qa->steps[0]->data['_choiceorder']);
$order = array_combine(array_values($order), array_keys($order));
@@ -541,11 +570,13 @@ public function test_match_deferredfeedback_history622220() {
'generalfeedback' => '<ul>
<li>Subject gateways provide links to sites that have been quality checked = True </li>
</ul>
- <p>All links in a subject gateway have been added by a knowledgeable subject specialist and so have to be of a certain quality to be added to the collection.</p>
+ <p>All links in a subject gateway have been added by a knowledgeable subject specialist and ' .
+ 'so have to be of a certain quality to be added to the collection.</p>
<ul>
<li>Subject gateways offer more variety than search engines = False </li>
</ul>
- <p>Subject gateways will most likely provide fewer links than a search engine, but this is because they are selected with a particular subject area in mind </p>
+ <p>Subject gateways will most likely provide fewer links than a search engine, but this is because ' .
+ 'they are selected with a particular subject area in mind </p>
<ul>
<li>Subject gateways index websites automatically = False </li>
</ul>
@@ -553,7 +584,8 @@ public function test_match_deferredfeedback_history622220() {
<ul>
<li>Subject gateways can provide a more direct route to websites containing academic content = True </li>
</ul>
- <p>All links in a subject gateway have been added by a knowledgeable subject specialist and so you can find academic content easier than using a web search engine.</p>',
+ <p>All links in a subject gateway have been added by a knowledgeable subject specialist ' .
+ 'and so you can find academic content easier than using a web search engine.</p>',
'generalfeedbackformat' => '1',
'timecreated' => '0',
'timemodified' => '0',
@@ -585,7 +617,8 @@ public function test_match_deferredfeedback_history622220() {
),
1635 => (object) array(
'questionid' => '11135',
- 'questiontext' => 'Subject gateways can provide a more direct route to websites containing academic content',
+ 'questiontext' => 'Subject gateways can provide a more direct route to websites ' .
+ 'containing academic content',
'answertext' => 'True',
'id' => 1635,
),
@@ -680,7 +713,7 @@ public function test_match_deferredfeedback_history622220() {
'question' => '11135',
'originalquestion' => '0',
'seq_number' => '5',
- 'answer' => '1633-1632,1635-1635,1634-1635,1632-1632',
+ 'answer' => '1633-1633,1635-1635,1634-1635,1632-1632',
'timestamp' => '1200507467',
'event' => '6',
'grade' => '0.75',
@@ -699,9 +732,20 @@ public function test_match_deferredfeedback_history622220() {
'maxmark' => 1,
'minfraction' => 0,
'flagged' => 0,
- 'questionsummary' => 'Which of the following statements about subject gateways are true, and which are false? {Subject gateways provide links to sites that have been quality checked; Subject gateways offer more variety than search engines; Subject gateways index websites automatically; Subject gateways can provide a more direct route to websites containing academic content} -> {True; False}',
- 'rightanswer' => 'Subject gateways provide links to sites that have been quality checked -> True; Subject gateways offer more variety than search engines -> False; Subject gateways index websites automatically -> False; Subject gateways can provide a more direct route to websites containing academic content -> True',
- 'responsesummary' => 'Subject gateways offer more variety than search engines -> False; Subject gateways can provide a more direct route to websites containing academic content -> True; Subject gateways index websites automatically -> True; Subject gateways provide links to sites that have been quality checked -> True',
+ 'questionsummary' => 'Which of the following statements about subject gateways are true, and which are false? ' .
+ '{Subject gateways provide links to sites that have been quality checked; ' .
+ 'Subject gateways offer more variety than search engines; ' .
+ 'Subject gateways index websites automatically; ' .
+ 'Subject gateways can provide a more direct route to websites containing academic content} ' .
+ '-> {True; False}',
+ 'rightanswer' => 'Subject gateways provide links to sites that have been quality checked -> True; ' .
+ 'Subject gateways offer more variety than search engines -> False; ' .
+ 'Subject gateways index websites automatically -> False; ' .
+ 'Subject gateways can provide a more direct route to websites containing academic content -> True',
+ 'responsesummary' => 'Subject gateways offer more variety than search engines -> False; ' .
+ 'Subject gateways can provide a more direct route to websites containing academic content -> True; ' .
+ 'Subject gateways index websites automatically -> True; ' .
+ 'Subject gateways provide links to sites that have been quality checked -> True',
'timemodified' => 1200507467,
'steps' => array(
0 => (object) array(
@@ -710,7 +754,8 @@ public function test_match_deferredfeedback_history622220() {
'fraction' => null,
'timecreated' => 1200506648,
'userid' => 6584,
- 'data' => array('_stemorder' => '1633,1635,1634,1632', '_choiceorder' => 'todo - see below'),
+ 'data' => array('_stemorder' => '1633,1635,1634,1632',
+ '_choiceorder' => 'todo - see below'),
),
1 => (object) array(
'sequencenumber' => 1,
@@ -755,7 +800,7 @@ public function test_match_deferredfeedback_history622220() {
),
);
- // This is a random thing, so just set expected to actual:
+ // This is a random thing, so just set expected to actual.
$expectedqa->steps[0]->data['_choiceorder'] = $qa->steps[0]->data['_choiceorder'];
$order = explode(',', $qa->steps[0]->data['_choiceorder']);
$order = array_combine(array_values($order), array_keys($order));
View
11 question/type/match/tests/walkthrough_test.php
@@ -18,10 +18,9 @@
* This file contains tests that walks a question through the interactive
* behaviour.
*
- * @package qtype
- * @subpackage match
- * @copyright 2010 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package qtype_match
+ * @copyright 2010 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -34,8 +33,8 @@
/**
* Unit tests for the matching question type.
*
- * @copyright 2010 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 2010 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_match_walkthrough_test extends qbehaviour_walkthrough_test_base {
View
7 question/type/match/version.php
@@ -17,10 +17,9 @@
/**
* Version information for the matching question type.
*
- * @package qtype
- * @subpackage match
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package qtype_match
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
Please sign in to comment.
Something went wrong with that request. Please try again.