Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

89 lines (73 sloc) 3.704 kb
// This file is part of Moodle -
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <>.
* This file contains tests that walks a question through the information item
* behaviour.
* @package qbehaviour
* @subpackage informationitem
* @copyright 2009 The Open University
* @license GNU GPL v3 or later
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once(dirname(__FILE__) . '/../../../engine/lib.php');
require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php');
* Unit tests for the information item behaviour.
* @copyright 2009 The Open University
* @license GNU GPL v3 or later
class qbehaviour_informationitem_walkthrough_test extends qbehaviour_walkthrough_test_base {
public function test_informationitem_feedback_description() {
// Create a true-false question with correct answer true.
$description = test_question_maker::make_question('description');
$this->start_attempt_at_question($description, 'deferredfeedback');
// Check the initial state.
new question_contains_tag_with_attributes('input', array('type' => 'hidden',
'name' => $this->quba->get_field_prefix($this->slot) . '-seen', 'value' => 1)),
// Process a submission indicating this question has been seen.
$this->process_submission(array('-seen' => 1));
new question_no_pattern_expectation(
// Finish the attempt.
// Verify.
// Process a manual comment.
$this->manual_grade('Not good enough!', null, FORMAT_HTML);
new question_pattern_expectation('/' . preg_quote('Not good enough!') . '/'));
// Check that trying to process a manual comment with a grade causes an exception.
$this->manual_grade('Not good enough!', 1, FORMAT_HTML);
Jump to Line
Something went wrong with that request. Please try again.