Ejemplo n.º 1
0
 /**
  * Test get_grades_table function case incorrect permissions
  */
 public function test_get_grades_table_permissions()
 {
     global $CFG, $DB;
     $this->resetAfterTest(true);
     $s1grade = 80;
     $s2grade = 60;
     list($course, $teacher, $student1, $student2, $assignment) = $this->load_data($s1grade, $s2grade);
     $this->setUser($student2);
     try {
         $studentgrade = gradereport_user_external::get_grades_table($course->id, $student1->id);
         $this->fail('Exception expected due to not perissions to view other user grades.');
     } catch (moodle_exception $e) {
         $this->assertEquals('notingroup', $e->errorcode);
     }
 }