Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 22... Línea 22...
22
 * @package gradereport_overview
22
 * @package gradereport_overview
23
 * @copyright 2023 The Open University
23
 * @copyright 2023 The Open University
24
 * @covers \grade_report_overview
24
 * @covers \grade_report_overview
25
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26
 */
26
 */
27
class lib_test extends \advanced_testcase {
27
final class lib_test extends \advanced_testcase {
Línea 28... Línea 28...
28
 
28
 
29
    /**
29
    /**
30
     * Require the library file we're about to test, and other requirements.
30
     * Require the library file we're about to test, and other requirements.
31
     */
31
     */
32
    protected function setUp(): void {
32
    protected function setUp(): void {
33
        global $CFG;
33
        global $CFG;
34
        require_once($CFG->dirroot . '/grade/report/overview/lib.php');
34
        require_once($CFG->dirroot . '/grade/report/overview/lib.php');
-
 
35
        require_once($CFG->dirroot . '/grade/querylib.php');
35
        require_once($CFG->dirroot . '/grade/querylib.php');
36
        parent::setUp();
Línea 36... Línea 37...
36
    }
37
    }
37
 
38
 
38
    /**
39
    /**
39
     * Data provider for true or false value.
40
     * Data provider for true or false value.
40
     *
41
     *
41
     * @return array Two options, one with true and one with false
42
     * @return array Two options, one with true and one with false
42
     */
43
     */
43
    public function true_or_false(): array {
44
    public static function true_or_false(): array {
44
        return [
45
        return [
45
            [true],
46
            [true],
46
            [false]
47
            [false]
Línea 111... Línea 112...
111
 
112
 
112
        // Construct the overview report and call regrade_all_courses_if_needed.
113
        // Construct the overview report and call regrade_all_courses_if_needed.
113
        $gpr = new \stdClass();
114
        $gpr = new \stdClass();
114
        $report = new \grade_report_overview($user->id, $gpr, '');
115
        $report = new \grade_report_overview($user->id, $gpr, '');
-
 
116
        $report->regrade_all_courses_if_needed($frontend);
-
 
117
        if (!$frontend) {
-
 
118
            $this->expectOutputRegex("~^Recalculating grades for course ID {$course->id}~");
-
 
119
            $this->run_all_adhoc_tasks();
Línea 115... Línea 120...
115
        $report->regrade_all_courses_if_needed($frontend);
120
        }
116
 
121
 
117
        // This should have regraded courses 1 and 3, but not 2 (because the user doesn't belong).
122
        // This should have regraded courses 1 and 3, but not 2 (because the user doesn't belong).
118
        $this->assertEqualsWithDelta(50.0, $DB->get_field('grade_grades', 'finalgrade',
123
        $this->assertEqualsWithDelta(50.0, $DB->get_field('grade_grades', 'finalgrade',