Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 28... Línea 28...
28
 * @copyright  nicolas@moodle.com
28
 * @copyright  nicolas@moodle.com
29
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30
 */
30
 */
31
class grade_grade_test extends \grade_base_testcase {
31
class grade_grade_test extends \grade_base_testcase {
Línea 32... Línea 32...
32
 
32
 
33
    public function test_grade_grade() {
33
    public function test_grade_grade(): void {
34
        $this->sub_test_grade_grade_construct();
34
        $this->sub_test_grade_grade_construct();
35
        $this->sub_test_grade_grade_insert();
35
        $this->sub_test_grade_grade_insert();
36
        $this->sub_test_grade_grade_update();
36
        $this->sub_test_grade_grade_update();
37
        $this->sub_test_grade_grade_fetch();
37
        $this->sub_test_grade_grade_fetch();
Línea 204... Línea 204...
204
    /**
204
    /**
205
     * Test \grade_grade::flatten_dependencies_array()
205
     * Test \grade_grade::flatten_dependencies_array()
206
     *
206
     *
207
     * @covers \grade_grade::flatten_dependencies_array()
207
     * @covers \grade_grade::flatten_dependencies_array()
208
     */
208
     */
209
    public function test_flatten_dependencies() {
209
    public function test_flatten_dependencies(): void {
210
        // First test a simple normal case.
210
        // First test a simple normal case.
211
        $a = array(1 => array(2, 3), 2 => array(), 3 => array(4), 4 => array());
211
        $a = array(1 => array(2, 3), 2 => array(), 3 => array(4), 4 => array());
212
        $b = array();
212
        $b = array();
213
        $expecteda = array(1 => array(2, 3, 4), 2 => array(), 3 => array(4), 4 => array());
213
        $expecteda = array(1 => array(2, 3, 4), 2 => array(), 3 => array(4), 4 => array());
214
        $expectedb = array(1 => 1);
214
        $expectedb = array(1 => 1);
Línea 301... Línea 301...
301
        \test_grade_grade_flatten_dependencies_array::test_flatten_dependencies_array($a, $b);
301
        \test_grade_grade_flatten_dependencies_array::test_flatten_dependencies_array($a, $b);
302
        $this->assertSame($expecteda, $a);
302
        $this->assertSame($expecteda, $a);
303
        $this->assertSame($expectedb, $b);
303
        $this->assertSame($expectedb, $b);
304
    }
304
    }
Línea 305... Línea 305...
305
 
305
 
306
    public function test_grade_grade_min_max() {
306
    public function test_grade_grade_min_max(): void {
307
        global $CFG;
307
        global $CFG;
Línea 308... Línea 308...
308
        $initialminmaxtouse = $CFG->grade_minmaxtouse;
308
        $initialminmaxtouse = $CFG->grade_minmaxtouse;
309
 
309
 
Línea 370... Línea 370...
370
        $this->assertEquals(50, $gg->get_grade_max());
370
        $this->assertEquals(50, $gg->get_grade_max());
Línea 371... Línea 371...
371
 
371
 
372
        $CFG->grade_minmaxtouse = $initialminmaxtouse;
372
        $CFG->grade_minmaxtouse = $initialminmaxtouse;
Línea 373... Línea 373...
373
    }
373
    }
374
 
374
 
375
    public function test_grade_grade_min_max_with_course_item() {
375
    public function test_grade_grade_min_max_with_course_item(): void {
Línea 376... Línea 376...
376
        global $CFG, $DB;
376
        global $CFG, $DB;
377
        $initialminmaxtouse = $CFG->grade_minmaxtouse;
377
        $initialminmaxtouse = $CFG->grade_minmaxtouse;
Línea 430... Línea 430...
430
        $this->assertEquals(100, $gg->get_grade_max());
430
        $this->assertEquals(100, $gg->get_grade_max());
Línea 431... Línea 431...
431
 
431
 
432
        $CFG->grade_minmaxtouse = $initialminmaxtouse;
432
        $CFG->grade_minmaxtouse = $initialminmaxtouse;
Línea 433... Línea 433...
433
    }
433
    }
434
 
434
 
435
    public function test_grade_grade_min_max_with_category_item() {
435
    public function test_grade_grade_min_max_with_category_item(): void {
Línea 436... Línea 436...
436
        global $CFG, $DB;
436
        global $CFG, $DB;
437
        $initialminmaxtouse = $CFG->grade_minmaxtouse;
437
        $initialminmaxtouse = $CFG->grade_minmaxtouse;
Línea 642... Línea 642...
642
    }
642
    }
Línea 643... Línea 643...
643
 
643
 
644
    /**
644
    /**
645
     * Tests get_hiding_affected by locked category and overridden grades.
645
     * Tests get_hiding_affected by locked category and overridden grades.
646
     */
646
     */
647
    public function test_category_get_hiding_affected() {
647
    public function test_category_get_hiding_affected(): void {
Línea 648... Línea 648...
648
        $generator = $this->getDataGenerator();
648
        $generator = $this->getDataGenerator();
649
 
649
 
650
        // Create the data we need for the tests.
650
        // Create the data we need for the tests.