// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * This file contains tests for the autosave code in the question_usage class.
+ * Unit tests for the parts of {@link question_engine_data_mapper} related to reporting.
*
- * @package moodlecore
- * @subpackage questionengine
- * @copyright 2013 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package core_question
+ * @category test
+ * @copyright 2013 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
- * Unit tests for the autosave parts of the {@link question_usage} class.
- *
- * Note that many of the methods used when attempting questions, like
- * load_questions_usage_by_activity, insert_question_*, delete_steps are
- * tested elsewhere, e.g. by {@link question_usage_autosave_test}. We do not
- * re-test them here.
+ * Unit tests for the parts of {@link question_engine_data_mapper} related to reporting.
*
* @copyright 2013 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class question_engine_data_mapper_testcase extends qbehaviour_walkthrough_test_base {
+class question_engine_data_mapper_reporting_testcase extends qbehaviour_walkthrough_test_base {
/** @var question_engine_data_mapper */
protected $dm;
$this->dotest_question_attempt_latest_state_view();
}
+ /**
+ * This test is executed by {@link test_reporting_queries()}.
+ */
protected function dotest_load_questions_usages_latest_steps() {
$rawstates = $this->dm->load_questions_usages_latest_steps($this->bothusages, $this->allslots,
'qa.id AS questionattemptid, qa.questionusageid, qa.slot, ' .
), $state);
}
+ /**
+ * This test is executed by {@link test_reporting_queries()}.
+ */
protected function dotest_load_questions_usages_question_state_summary() {
$summary = $this->dm->load_questions_usages_question_state_summary(
$this->bothusages, $this->allslots);
));
}
+ /**
+ * This test is executed by {@link test_reporting_queries()}.
+ */
protected function dotest_load_questions_usages_where_question_in_state() {
$this->assertEquals(
array(array($this->usageids[0], $this->usageids[1]), 2),
'needsgrading', $this->allslots[1], null, 'questionusageid'));
}
+ /**
+ * This test is executed by {@link test_reporting_queries()}.
+ */
protected function dotest_load_average_marks() {
$averages = $this->dm->load_average_marks($this->bothusages);
), $averages);
}
+ /**
+ * This test is executed by {@link test_reporting_queries()}.
+ */
protected function dotest_sum_usage_marks_subquery() {
global $DB;
$this->assertEquals(0, $totals[$this->usageids[1]]);
}
+ /**
+ * This test is executed by {@link test_reporting_queries()}.
+ */
protected function dotest_question_attempt_latest_state_view() {
global $DB;