MDL-40493 question: set real $USER before testing question walktrough
authorPetr Škoda <commits@skodak.org>
Tue, 8 Oct 2013 21:21:34 +0000 (23:21 +0200)
committerSam Hemelryk <sam@moodle.com>
Tue, 8 Oct 2013 22:02:35 +0000 (11:02 +1300)
question/behaviour/manualgraded/tests/walkthrough_test.php
question/type/essay/tests/walkthrough_test.php

index b8f2c79..2a3aaea 100644 (file)
@@ -41,6 +41,8 @@ require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php');
 class qbehaviour_manualgraded_walkthrough_testcase extends qbehaviour_walkthrough_test_base {
     public function test_manual_graded_essay() {
 
+        $this->setAdminUser();
+
         // Create an essay question.
         $essay = test_question_maker::make_an_essay_question();
         $this->start_attempt_at_question($essay, 'deferredfeedback', 10);
@@ -108,6 +110,8 @@ class qbehaviour_manualgraded_walkthrough_testcase extends qbehaviour_walkthroug
 
     public function test_manual_graded_essay_not_answered() {
 
+        $this->setAdminUser();
+
         // Create an essay question.
         $essay = test_question_maker::make_an_essay_question();
         $this->start_attempt_at_question($essay, 'deferredfeedback', 10);
@@ -268,6 +272,8 @@ class qbehaviour_manualgraded_walkthrough_testcase extends qbehaviour_walkthroug
 
     public function test_manual_graded_essay_can_grade_0() {
 
+        $this->setAdminUser();
+
         // Create an essay question.
         $essay = test_question_maker::make_an_essay_question();
         $this->start_attempt_at_question($essay, 'deferredfeedback', 10);
index e641492..242951b 100644 (file)
@@ -74,6 +74,8 @@ class qtype_essay_walkthrough_testcase extends qbehaviour_walkthrough_test_base
 
     public function test_deferred_feedback_html_editor() {
 
+        $this->setAdminUser();
+
         // Create an essay question.
         $q = test_question_maker::make_question('essay', 'editor');
         $this->start_attempt_at_question($q, 'deferredfeedback', 1);
@@ -178,6 +180,8 @@ class qtype_essay_walkthrough_testcase extends qbehaviour_walkthrough_test_base
 
     public function test_responsetemplate() {
 
+        $this->setAdminUser();
+
         // Create an essay question.
         $q = test_question_maker::make_question('essay', 'responsetemplate');
         $this->start_attempt_at_question($q, 'deferredfeedback', 1);