mirror of
https://github.com/moodle/moodle.git
synced 2025-07-25 08:11:39 +02:00
MDL-52471 completion: fix deprecated use of 'object'
And add a unit test covering completion_can_view_data() without full course object passed.
This commit is contained in:
@@ -858,6 +858,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 {
|
||||
|
Reference in New Issue
Block a user