Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 49... Línea 49...
49
    }
49
    }
Línea 50... Línea 50...
50
 
50
 
51
    /**
51
    /**
52
     * Tests constructing and using condition as part of tree.
52
     * Tests constructing and using condition as part of tree.
53
     */
53
     */
54
    public function test_in_tree() {
54
    public function test_in_tree(): void {
55
        global $USER, $CFG;
55
        global $USER, $CFG;
Línea 56... Línea 56...
56
        $this->resetAfterTest();
56
        $this->resetAfterTest();
Línea 99... Línea 99...
99
 
99
 
100
    /**
100
    /**
101
     * Tests the constructor including error conditions. Also tests the
101
     * Tests the constructor including error conditions. Also tests the
102
     * string conversion feature (intended for debugging only).
102
     * string conversion feature (intended for debugging only).
103
     */
103
     */
104
    public function test_constructor() {
104
    public function test_constructor(): void {
105
        // No parameters.
105
        // No parameters.
106
        $structure = new \stdClass();
106
        $structure = new \stdClass();
107
        try {
107
        try {
108
            $cond = new condition($structure);
108
            $cond = new condition($structure);
Línea 163... Línea 163...
163
    }
163
    }
Línea 164... Línea 164...
164
 
164
 
165
    /**
165
    /**
166
     * Tests the save() function.
166
     * Tests the save() function.
167
     */
167
     */
168
    public function test_save() {
168
    public function test_save(): void {
169
        $structure = (object)['cm' => 42, 'e' => COMPLETION_COMPLETE];
169
        $structure = (object)['cm' => 42, 'e' => COMPLETION_COMPLETE];
170
        $cond = new condition($structure);
170
        $cond = new condition($structure);
171
        $structure->type = 'completion';
171
        $structure->type = 'completion';
172
        $this->assertEquals($structure, $cond->save());
172
        $this->assertEquals($structure, $cond->save());
Línea 173... Línea 173...
173
    }
173
    }
174
 
174
 
175
    /**
175
    /**
176
     * Tests the is_available and get_description functions.
176
     * Tests the is_available and get_description functions.
177
     */
177
     */
178
    public function test_usage() {
178
    public function test_usage(): void {
179
        global $CFG, $DB;
179
        global $CFG, $DB;
Línea 180... Línea 180...
180
        require_once($CFG->dirroot . '/mod/assign/locallib.php');
180
        require_once($CFG->dirroot . '/mod/assign/locallib.php');
Línea 686... Línea 686...
686
    }
686
    }
Línea 687... Línea 687...
687
 
687
 
688
    /**
688
    /**
689
     * Tests completion_value_used static function.
689
     * Tests completion_value_used static function.
690
     */
690
     */
691
    public function test_completion_value_used() {
691
    public function test_completion_value_used(): void {
692
        global $CFG, $DB;
692
        global $CFG, $DB;
693
        $this->resetAfterTest();
693
        $this->resetAfterTest();
Línea 694... Línea 694...
694
        $prevvalue = condition::OPTION_PREVIOUS;
694
        $prevvalue = condition::OPTION_PREVIOUS;
Línea 766... Línea 766...
766
    }
766
    }
Línea 767... Línea 767...
767
 
767
 
768
    /**
768
    /**
769
     * Tests the update_dependency_id() function.
769
     * Tests the update_dependency_id() function.
770
     */
770
     */
771
    public function test_update_dependency_id() {
771
    public function test_update_dependency_id(): void {
772
        $cond = new condition((object)[
772
        $cond = new condition((object)[
773
            'cm' => 42, 'e' => COMPLETION_COMPLETE, 'selfid' => 43
773
            'cm' => 42, 'e' => COMPLETION_COMPLETE, 'selfid' => 43
774
        ]);
774
        ]);
775
        $this->assertFalse($cond->update_dependency_id('frogs', 42, 540));
775
        $this->assertFalse($cond->update_dependency_id('frogs', 42, 540));