mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
Merge branch 'MDL-72843-qbank_comment-unit-testsuite-resolve' of https://github.com/catalyst/moodle-MDL-70329
This commit is contained in:
commit
440fac33bb
@ -25,6 +25,8 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->dirroot. '/comment/lib.php');
|
||||
|
||||
/**
|
||||
* Validate comment parameter before perform other comments actions.
|
||||
*
|
||||
@ -105,7 +107,6 @@ function qbank_comment_preview_display($question, $courseid): string {
|
||||
*
|
||||
* @param array $args
|
||||
* @return string rendered output
|
||||
* @todo cleanup after class renaming to remove check for previewlib.php MDL-71679
|
||||
*/
|
||||
function qbank_comment_output_fragment_question_comment($args): string {
|
||||
global $USER, $PAGE, $CFG;
|
||||
@ -115,19 +116,16 @@ function qbank_comment_output_fragment_question_comment($args): string {
|
||||
$quba = question_engine::make_questions_usage_by_activity(
|
||||
'core_question_preview', context_user::instance($USER->id));
|
||||
|
||||
// Just in case of any regression, it should not break the modal, just show the comments.
|
||||
if (class_exists('\\qbank_previewquestion\\question_preview_options')) {
|
||||
$options = new \qbank_previewquestion\question_preview_options($question);
|
||||
} else {
|
||||
require_once($CFG->dirroot . '/question/previewlib.php');
|
||||
$options = new question_preview_options($question);
|
||||
$options->load_user_defaults();
|
||||
$options->set_from_request();
|
||||
$quba->set_preferred_behaviour($options->behaviour);
|
||||
$slot = $quba->add_question($question, $options->maxmark);
|
||||
$quba->start_question($slot, $options->variant);
|
||||
$displaydata['question'] = $quba->render_question($slot, $options, '1');
|
||||
}
|
||||
|
||||
$options->load_user_defaults();
|
||||
$options->set_from_request();
|
||||
$quba->set_preferred_behaviour($options->behaviour);
|
||||
$slot = $quba->add_question($question, $options->maxmark);
|
||||
$quba->start_question($slot, $options->variant);
|
||||
$displaydata['question'] = $quba->render_question($slot, $options, '1');
|
||||
$displaydata['comment'] = qbank_comment_preview_display($question, $args['courseid']);
|
||||
$displaydata['commenstdisabled'] = false;
|
||||
if (empty($displaydata['comment']) && !$CFG->usecomments) {
|
||||
|
@ -19,7 +19,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
|
||||
require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
|
||||
|
||||
require_once($CFG->dirroot. '/comment/lib.php');
|
||||
|
||||
/**
|
||||
* Question comment backup and restore unit tests.
|
||||
@ -138,7 +138,6 @@ class qbank_comment_backup_restore_test extends \advanced_testcase {
|
||||
*/
|
||||
public function test_backup_restore() {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user