Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 25... Línea 25...
25
 */
25
 */
26
class condition_test extends \advanced_testcase {
26
class condition_test extends \advanced_testcase {
27
    /**
27
    /**
28
     * Tests constructing and using grade condition.
28
     * Tests constructing and using grade condition.
29
     */
29
     */
30
    public function test_usage() {
30
    public function test_usage(): void {
31
        global $USER, $CFG;
31
        global $USER, $CFG;
32
        require_once($CFG->dirroot . '/mod/assign/locallib.php');
32
        require_once($CFG->dirroot . '/mod/assign/locallib.php');
Línea 33... Línea 33...
33
 
33
 
34
        $this->resetAfterTest();
34
        $this->resetAfterTest();
Línea 139... Línea 139...
139
 
139
 
140
    /**
140
    /**
141
     * Tests the constructor including error conditions. Also tests the
141
     * Tests the constructor including error conditions. Also tests the
142
     * string conversion feature (intended for debugging only).
142
     * string conversion feature (intended for debugging only).
143
     */
143
     */
144
    public function test_constructor() {
144
    public function test_constructor(): void {
145
        // No parameters.
145
        // No parameters.
146
        $structure = new \stdClass();
146
        $structure = new \stdClass();
147
        try {
147
        try {
148
            $cond = new condition($structure);
148
            $cond = new condition($structure);
Línea 203... Línea 203...
203
    }
203
    }
Línea 204... Línea 204...
204
 
204
 
205
    /**
205
    /**
206
     * Tests the save() function.
206
     * Tests the save() function.
207
     */
207
     */
208
    public function test_save() {
208
    public function test_save(): void {
209
        $structure = (object)array('id' => 19);
209
        $structure = (object)array('id' => 19);
210
        $cond = new condition($structure);
210
        $cond = new condition($structure);
211
        $structure->type = 'grade';
211
        $structure->type = 'grade';
Línea 233... Línea 233...
233
    }
233
    }
Línea 234... Línea 234...
234
 
234
 
235
    /**
235
    /**
236
     * Tests the update_dependency_id() function.
236
     * Tests the update_dependency_id() function.
237
     */
237
     */
238
    public function test_update_dependency_id() {
238
    public function test_update_dependency_id(): void {
239
        $cond = new condition((object)array('id' => 123));
239
        $cond = new condition((object)array('id' => 123));
240
        $this->assertFalse($cond->update_dependency_id('frogs', 123, 456));
240
        $this->assertFalse($cond->update_dependency_id('frogs', 123, 456));
241
        $this->assertFalse($cond->update_dependency_id('grade_items', 12, 34));
241
        $this->assertFalse($cond->update_dependency_id('grade_items', 12, 34));
242
        $this->assertTrue($cond->update_dependency_id('grade_items', 123, 456));
242
        $this->assertTrue($cond->update_dependency_id('grade_items', 123, 456));