Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 34... Línea 34...
34
    }
34
    }
Línea 35... Línea 35...
35
 
35
 
36
    /**
36
    /**
37
     * Tests constructing and using condition.
37
     * Tests constructing and using condition.
38
     */
38
     */
39
    public function test_usage() {
39
    public function test_usage(): void {
40
        global $CFG, $USER;
40
        global $CFG, $USER;
41
        $this->resetAfterTest();
41
        $this->resetAfterTest();
Línea 42... Línea 42...
42
        $CFG->enableavailability = true;
42
        $CFG->enableavailability = true;
Línea 113... Línea 113...
113
 
113
 
114
    /**
114
    /**
115
     * Tests the constructor including error conditions. Also tests the
115
     * Tests the constructor including error conditions. Also tests the
116
     * string conversion feature (intended for debugging only).
116
     * string conversion feature (intended for debugging only).
117
     */
117
     */
118
    public function test_constructor() {
118
    public function test_constructor(): void {
119
        // No parameters.
119
        // No parameters.
120
        $structure = new \stdClass();
120
        $structure = new \stdClass();
121
        try {
121
        try {
122
            $cond = new condition($structure);
122
            $cond = new condition($structure);
Línea 166... Línea 166...
166
    }
166
    }
Línea 167... Línea 167...
167
 
167
 
168
    /**
168
    /**
169
     * Tests the save() function.
169
     * Tests the save() function.
170
     */
170
     */
171
    public function test_save() {
171
    public function test_save(): void {
172
        $structure = (object)array('id' => 123);
172
        $structure = (object)array('id' => 123);
173
        $cond = new condition($structure);
173
        $cond = new condition($structure);
174
        $structure->type = 'grouping';
174
        $structure->type = 'grouping';
Línea 181... Línea 181...
181
    }
181
    }
Línea 182... Línea 182...
182
 
182
 
183
    /**
183
    /**
184
     * Tests the update_dependency_id() function.
184
     * Tests the update_dependency_id() function.
185
     */
185
     */
186
    public function test_update_dependency_id() {
186
    public function test_update_dependency_id(): void {
187
        $cond = new condition((object)array('id' => 123));
187
        $cond = new condition((object)array('id' => 123));
188
        $this->assertFalse($cond->update_dependency_id('frogs', 123, 456));
188
        $this->assertFalse($cond->update_dependency_id('frogs', 123, 456));
189
        $this->assertFalse($cond->update_dependency_id('groupings', 12, 34));
189
        $this->assertFalse($cond->update_dependency_id('groupings', 12, 34));
190
        $this->assertTrue($cond->update_dependency_id('groupings', 123, 456));
190
        $this->assertTrue($cond->update_dependency_id('groupings', 123, 456));
Línea 197... Línea 197...
197
 
197
 
198
    /**
198
    /**
199
     * Tests the filter_users (bulk checking) function. Also tests the SQL
199
     * Tests the filter_users (bulk checking) function. Also tests the SQL
200
     * variant get_user_list_sql.
200
     * variant get_user_list_sql.
201
     */
201
     */
202
    public function test_filter_users() {
202
    public function test_filter_users(): void {
203
        global $DB, $CFG;
203
        global $DB, $CFG;
204
        $this->resetAfterTest();
204
        $this->resetAfterTest();
Línea 205... Línea 205...
205
        $CFG->enableavailability = true;
205
        $CFG->enableavailability = true;