Merge branch 'MDL-52471-master' of git://github.com/danpoltawski/moodle
This commit is contained in:
@@ -158,7 +158,7 @@ function completion_can_view_data($userid, $course = null) {
|
||||
|
||||
if (!is_object($course)) {
|
||||
$cid = $course;
|
||||
$course = new object();
|
||||
$course = new stdClass();
|
||||
$course->id = $cid;
|
||||
}
|
||||
|
||||
|
||||
+8
-1
@@ -63,7 +63,14 @@ define('MEMORY_HUGE', -4);
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @deprecated since 2.0
|
||||
*/
|
||||
class object extends stdClass {};
|
||||
class object extends stdClass {
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
debugging("'object' class has been deprecated, please use stdClass instead.", DEBUG_DEVELOPER);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Base Moodle Exception class
|
||||
|
||||
@@ -59,15 +59,7 @@ class core_completionlib_testcase extends advanced_testcase {
|
||||
// Create a course with activities.
|
||||
$this->course = $this->getDataGenerator()->create_course(array('enablecompletion' => true));
|
||||
$this->user = $this->getDataGenerator()->create_user();
|
||||
$studentrole = $DB->get_record('role', array('shortname' => 'student'));
|
||||
$this->assertNotEmpty($studentrole);
|
||||
|
||||
// Get manual enrolment plugin and enrol user.
|
||||
require_once($CFG->dirroot.'/enrol/manual/locallib.php');
|
||||
$manplugin = enrol_get_plugin('manual');
|
||||
$maninstance = $DB->get_record('enrol', array('courseid' => $this->course->id, 'enrol' => 'manual'), '*', MUST_EXIST);
|
||||
$manplugin->enrol_user($maninstance, $this->user->id, $studentrole->id);
|
||||
$this->assertEquals(1, $DB->count_records('user_enrolments'));
|
||||
$this->getDataGenerator()->enrol_user($this->user->id, $this->course->id);
|
||||
|
||||
$this->module1 = $this->getDataGenerator()->create_module('forum', array('course' => $this->course->id));
|
||||
$this->module2 = $this->getDataGenerator()->create_module('forum', array('course' => $this->course->id));
|
||||
@@ -858,6 +850,17 @@ class core_completionlib_testcase extends advanced_testcase {
|
||||
$expectedlegacylog = array($this->course->id, 'course', 'completion updated', 'completion.php?id='.$this->course->id);
|
||||
$this->assertEventLegacyLogData($expectedlegacylog, $event);
|
||||
}
|
||||
|
||||
public function test_completion_can_view_data() {
|
||||
$this->setup_data();
|
||||
|
||||
$student = $this->getDataGenerator()->create_user();
|
||||
$this->getDataGenerator()->enrol_user($student->id, $this->course->id);
|
||||
|
||||
$this->setUser($student);
|
||||
$this->assertTrue(completion_can_view_data($student->id, $this->course->id));
|
||||
$this->assertFalse(completion_can_view_data($this->user->id, $this->course->id));
|
||||
}
|
||||
}
|
||||
|
||||
class core_completionlib_fake_recordset implements Iterator {
|
||||
|
||||
@@ -460,4 +460,10 @@ class core_setuplib_testcase extends advanced_testcase {
|
||||
return get_exception_info($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_object() {
|
||||
$obj = new object();
|
||||
$this->assertDebuggingCalled("'object' class has been deprecated, please use stdClass instead.");
|
||||
$this->assertInstanceOf('stdClass', $obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1975,23 +1975,6 @@ class quiz_attempt {
|
||||
$event->trigger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the fields of the comment form for questions in this attempt.
|
||||
* @param $slot which question to output the fields for.
|
||||
* @param $prefix Prefix to add to all field names.
|
||||
*/
|
||||
public function question_print_comment_fields($slot, $prefix) {
|
||||
// Work out a nice title.
|
||||
$student = get_record('user', 'id', $this->get_userid());
|
||||
$a = new object();
|
||||
$a->fullname = fullname($student, true);
|
||||
$a->attempt = $this->get_attempt_number();
|
||||
|
||||
question_print_comment_fields($this->quba->get_question_attempt($slot),
|
||||
$prefix, $this->get_display_options(true)->markdp,
|
||||
get_string('gradingattempt', 'quiz_grading', $a));
|
||||
}
|
||||
|
||||
// Private methods =========================================================
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
This files describes API changes in the quiz code.
|
||||
|
||||
=== 3.1 ===
|
||||
* quiz_attempt::question_print_comment_fields() has been removed. It was broken
|
||||
since at least Moodle 2.0.
|
||||
|
||||
=== 2.9 ===
|
||||
|
||||
* There have been changes in classes/output/edit_renderer.php for MDL-40990.
|
||||
|
||||
Reference in New Issue
Block a user