diff --git a/question/behaviour/manualgraded/tests/walkthrough_test.php b/question/behaviour/manualgraded/tests/walkthrough_test.php index f17c681e54b..0e2aec82a32 100644 --- a/question/behaviour/manualgraded/tests/walkthrough_test.php +++ b/question/behaviour/manualgraded/tests/walkthrough_test.php @@ -40,9 +40,12 @@ require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); */ class qbehaviour_manualgraded_walkthrough_testcase extends qbehaviour_walkthrough_test_base { public function test_manual_graded_essay() { + global $PAGE; // The current text editor depends on the users profile setting - so it needs a valid user. $this->setAdminUser(); + // Required to init a text editor. + $PAGE->set_url('/'); // Create an essay question. $essay = test_question_maker::make_an_essay_question(); @@ -110,9 +113,12 @@ class qbehaviour_manualgraded_walkthrough_testcase extends qbehaviour_walkthroug } public function test_manual_graded_essay_not_answered() { + global $PAGE; // The current text editor depends on the users profile setting - so it needs a valid user. $this->setAdminUser(); + // Required to init a text editor. + $PAGE->set_url('/'); // Create an essay question. $essay = test_question_maker::make_an_essay_question(); @@ -273,9 +279,12 @@ class qbehaviour_manualgraded_walkthrough_testcase extends qbehaviour_walkthroug } public function test_manual_graded_essay_can_grade_0() { + global $PAGE; // The current text editor depends on the users profile setting - so it needs a valid user. $this->setAdminUser(); + // Required to init a text editor. + $PAGE->set_url('/'); // Create an essay question. $essay = test_question_maker::make_an_essay_question(); @@ -322,9 +331,12 @@ class qbehaviour_manualgraded_walkthrough_testcase extends qbehaviour_walkthroug public function test_manual_graded_respects_display_options() { // This test is for MDL-43874. Manual comments were not respecting the // Display options for feedback. + global $PAGE; // The current text editor depends on the users profile setting - so it needs a valid user. $this->setAdminUser(); + // Required to init a text editor. + $PAGE->set_url('/'); // Create an essay question. $essay = test_question_maker::make_an_essay_question(); diff --git a/question/type/essay/tests/walkthrough_test.php b/question/type/essay/tests/walkthrough_test.php index 37d183109c8..d39894695ab 100644 --- a/question/type/essay/tests/walkthrough_test.php +++ b/question/type/essay/tests/walkthrough_test.php @@ -73,9 +73,12 @@ class qtype_essay_walkthrough_testcase extends qbehaviour_walkthrough_test_base } public function test_deferred_feedback_html_editor() { + global $PAGE; // The current text editor depends on the users profile setting - so it needs a valid user. $this->setAdminUser(); + // Required to init a text editor. + $PAGE->set_url('/'); // Create an essay question. $q = test_question_maker::make_question('essay', 'editor'); @@ -180,9 +183,12 @@ class qtype_essay_walkthrough_testcase extends qbehaviour_walkthrough_test_base } public function test_responsetemplate() { + global $PAGE; // The current text editor depends on the users profile setting - so it needs a valid user. $this->setAdminUser(); + // Required to init a text editor. + $PAGE->set_url('/'); // Create an essay question. $q = test_question_maker::make_question('essay', 'responsetemplate'); @@ -234,10 +240,12 @@ class qtype_essay_walkthrough_testcase extends qbehaviour_walkthrough_test_base } public function test_deferred_feedback_html_editor_with_files_attempt_on_last() { - global $CFG, $USER; + global $CFG, $USER, $PAGE; $this->resetAfterTest(true); $this->setAdminUser(); + // Required to init a text editor. + $PAGE->set_url('/'); $usercontextid = context_user::instance($USER->id)->id; $fs = get_file_storage(); @@ -356,10 +364,12 @@ class qtype_essay_walkthrough_testcase extends qbehaviour_walkthrough_test_base } public function test_deferred_feedback_html_editor_with_files_attempt_on_last_no_files_uploaded() { - global $CFG, $USER; + global $CFG, $USER, $PAGE; $this->resetAfterTest(true); $this->setAdminUser(); + // Required to init a text editor. + $PAGE->set_url('/'); $usercontextid = context_user::instance($USER->id)->id; $fs = get_file_storage();