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
        // Invalid id (not int).
119
        // Invalid id (not int).
120
        $structure = (object)array('id' => 'bourne');
120
        $structure = (object)array('id' => 'bourne');
121
        try {
121
        try {
122
            $cond = new condition($structure);
122
            $cond = new condition($structure);
Línea 137... Línea 137...
137
    }
137
    }
Línea 138... Línea 138...
138
 
138
 
139
    /**
139
    /**
140
     * Tests the save() function.
140
     * Tests the save() function.
141
     */
141
     */
142
    public function test_save() {
142
    public function test_save(): void {
143
        $structure = (object)array('id' => 123);
143
        $structure = (object)array('id' => 123);
144
        $cond = new condition($structure);
144
        $cond = new condition($structure);
145
        $structure->type = 'group';
145
        $structure->type = 'group';
Línea 152... Línea 152...
152
    }
152
    }
Línea 153... Línea 153...
153
 
153
 
154
    /**
154
    /**
155
     * Tests the update_dependency_id() function.
155
     * Tests the update_dependency_id() function.
156
     */
156
     */
157
    public function test_update_dependency_id() {
157
    public function test_update_dependency_id(): void {
158
        $cond = new condition((object)array('id' => 123));
158
        $cond = new condition((object)array('id' => 123));
159
        $this->assertFalse($cond->update_dependency_id('frogs', 123, 456));
159
        $this->assertFalse($cond->update_dependency_id('frogs', 123, 456));
160
        $this->assertFalse($cond->update_dependency_id('groups', 12, 34));
160
        $this->assertFalse($cond->update_dependency_id('groups', 12, 34));
161
        $this->assertTrue($cond->update_dependency_id('groups', 123, 456));
161
        $this->assertTrue($cond->update_dependency_id('groups', 123, 456));
Línea 165... Línea 165...
165
 
165
 
166
    /**
166
    /**
167
     * Tests the filter_users (bulk checking) function. Also tests the SQL
167
     * Tests the filter_users (bulk checking) function. Also tests the SQL
168
     * variant get_user_list_sql.
168
     * variant get_user_list_sql.
169
     */
169
     */
170
    public function test_filter_users() {
170
    public function test_filter_users(): void {
171
        global $DB;
171
        global $DB;
Línea 172... Línea 172...
172
        $this->resetAfterTest();
172
        $this->resetAfterTest();
173
 
173