mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'MDL-49666' of git://github.com/timhunt/moodle
This commit is contained in:
commit
f5c493f75e
@ -17,13 +17,11 @@
|
||||
/**
|
||||
* Defines the renderer the information item behaviour.
|
||||
*
|
||||
* @package qbehaviour
|
||||
* @subpackage informationitem
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @package qbehaviour_informationitem
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
@ -31,12 +29,12 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* Renderer for outputting parts of a question belonging to the information
|
||||
* item behaviour.
|
||||
*
|
||||
* @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 qbehaviour_informationitem_renderer extends qbehaviour_renderer {
|
||||
public function controls(question_attempt $qa, question_display_options $options) {
|
||||
if ($qa->get_state() != question_state::$todo) {
|
||||
if ($options->readonly || $qa->get_state() != question_state::$todo) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php');
|
||||
* @copyright 2015 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class qbehaviour_informationitem_type_test extends basic_testcase {
|
||||
class qbehaviour_informationitem_type_testcase extends basic_testcase {
|
||||
|
||||
/** @var qbehaviour_informationitem_type */
|
||||
protected $behaviourtype;
|
||||
|
@ -18,13 +18,12 @@
|
||||
* This file contains tests that walks a question through the information item
|
||||
* behaviour.
|
||||
*
|
||||
* @package qbehaviour
|
||||
* @subpackage informationitem
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @package qbehaviour_informationitem
|
||||
* @category test
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
@ -35,10 +34,10 @@ require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php');
|
||||
/**
|
||||
* Unit tests for the information item behaviour.
|
||||
*
|
||||
* @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 qbehaviour_informationitem_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
class qbehaviour_informationitem_walkthrough_testcase extends qbehaviour_walkthrough_test_base {
|
||||
public function test_informationitem_feedback_description() {
|
||||
|
||||
// Create a true-false question with correct answer true.
|
||||
@ -49,10 +48,17 @@ class qbehaviour_informationitem_walkthrough_test extends qbehaviour_walkthrough
|
||||
$this->check_current_state(question_state::$todo);
|
||||
$this->check_current_mark(null);
|
||||
$this->check_current_output($this->get_contains_question_text_expectation($description),
|
||||
new question_contains_tag_with_attributes('input', array('type' => 'hidden',
|
||||
'name' => $this->quba->get_field_prefix($this->slot) . '-seen', 'value' => 1)),
|
||||
$this->get_contains_hidden_expectation(
|
||||
$this->quba->get_field_prefix($this->slot) . '-seen', 1),
|
||||
$this->get_does_not_contain_feedback_expectation());
|
||||
|
||||
// Check no hidden input when read-only.
|
||||
$this->displayoptions->readonly = true;
|
||||
$this->check_current_output($this->get_contains_question_text_expectation($description),
|
||||
$this->get_does_not_contain_hidden_expectation(
|
||||
$this->quba->get_field_prefix($this->slot) . '-seen', 1));
|
||||
$this->displayoptions->readonly = false;
|
||||
|
||||
// Process a submission indicating this question has been seen.
|
||||
$this->process_submission(array('-seen' => 1));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user