$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 {