Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 44... Línea 44...
44
class admintree_test extends \advanced_testcase {
44
class admintree_test extends \advanced_testcase {
Línea 45... Línea 45...
45
 
45
 
46
    /**
46
    /**
47
     * Adding nodes into the admin tree.
47
     * Adding nodes into the admin tree.
48
     */
48
     */
Línea 49... Línea 49...
49
    public function test_add_nodes() {
49
    public function test_add_nodes(): void {
50
 
50
 
51
        $tree = new admin_root(true);
51
        $tree = new admin_root(true);
52
        $tree->add('root', $one = new admin_category('one', 'One'));
52
        $tree->add('root', $one = new admin_category('one', 'One'));
Línea 102... Línea 102...
102
            $map[] = $child->name;
102
            $map[] = $child->name;
103
        }
103
        }
104
        $this->assertEquals(array('zero', 'one', 'two', 'three', 'four', 'five', 'six'), $map);
104
        $this->assertEquals(array('zero', 'one', 'two', 'three', 'four', 'five', 'six'), $map);
105
    }
105
    }
Línea 106... Línea 106...
106
 
106
 
107
    public function test_add_nodes_before_invalid1() {
107
    public function test_add_nodes_before_invalid1(): void {
108
        $tree = new admin_root(true);
108
        $tree = new admin_root(true);
109
        $this->expectException(\coding_exception::class);
109
        $this->expectException(\coding_exception::class);
110
        $tree->add('root', new admin_externalpage('foo', 'Foo', 'http://foo.bar'), array('moodle:site/config'));
110
        $tree->add('root', new admin_externalpage('foo', 'Foo', 'http://foo.bar'), array('moodle:site/config'));
Línea 111... Línea 111...
111
    }
111
    }
112
 
112
 
113
    public function test_add_nodes_before_invalid2() {
113
    public function test_add_nodes_before_invalid2(): void {
114
        $tree = new admin_root(true);
114
        $tree = new admin_root(true);
115
        $this->expectException(\coding_exception::class);
115
        $this->expectException(\coding_exception::class);
Línea 116... Línea 116...
116
        $tree->add('root', new admin_category('bar', 'Bar'), '');
116
        $tree->add('root', new admin_category('bar', 'Bar'), '');
117
    }
117
    }
118
 
118
 
119
    /**
119
    /**
120
     * Test that changes to config trigger events.
120
     * Test that changes to config trigger events.
121
     */
121
     */
122
    public function test_config_log_created_event() {
122
    public function test_config_log_created_event(): void {
Línea 123... Línea 123...
123
        global $DB;
123
        global $DB;
Línea 154... Línea 154...
154
    }
154
    }
Línea 155... Línea 155...
155
 
155
 
156
    /**
156
    /**
157
     * Testing whether a configexecutable setting is executable.
157
     * Testing whether a configexecutable setting is executable.
158
     */
158
     */
159
    public function test_admin_setting_configexecutable() {
159
    public function test_admin_setting_configexecutable(): void {
160
        global $CFG;
160
        global $CFG;
Línea 161... Línea 161...
161
        $this->resetAfterTest();
161
        $this->resetAfterTest();
162
 
162
 
Línea 191... Línea 191...
191
    }
191
    }
Línea 192... Línea 192...
192
 
192
 
193
    /**
193
    /**
194
     * Saving of values.
194
     * Saving of values.
195
     */
195
     */
196
    public function test_config_logging() {
196
    public function test_config_logging(): void {
197
        global $DB;
197
        global $DB;
198
        $this->resetAfterTest();
198
        $this->resetAfterTest();
Línea 199... Línea 199...
199
        $this->setAdminUser();
199
        $this->setAdminUser();
Línea 289... Línea 289...
289
        }
289
        }
Línea 290... Línea 290...
290
 
290
 
291
        return $count;
291
        return $count;
Línea 292... Línea 292...
292
    }
292
    }
293
 
293
 
Línea 294... Línea 294...
294
    public function test_preventexecpath() {
294
    public function test_preventexecpath(): void {
295
        $this->resetAfterTest();
295
        $this->resetAfterTest();
296
 
296
 
Línea 367... Línea 367...
367
    }
367
    }
Línea 368... Línea 368...
368
 
368
 
369
    /**
369
    /**
370
     * Test setting an empty duration displays the correct validation message.
370
     * Test setting an empty duration displays the correct validation message.
371
     */
371
     */
372
    public function test_emptydurationvalue() {
372
    public function test_emptydurationvalue(): void {
373
        $this->resetAfterTest();
373
        $this->resetAfterTest();
Línea 374... Línea 374...
374
        $adminsetting = new admin_setting_configduration('abc_cde/duration', 'some desc', '', '');
374
        $adminsetting = new admin_setting_configduration('abc_cde/duration', 'some desc', '', '');
375
 
375
 
Línea 381... Línea 381...
381
     * Test setting for blocked hosts
381
     * Test setting for blocked hosts
382
     *
382
     *
383
     * For testing the admin settings element only. Test for blocked hosts functionality can be found
383
     * For testing the admin settings element only. Test for blocked hosts functionality can be found
384
     * in lib/tests/curl_security_helper_test.php
384
     * in lib/tests/curl_security_helper_test.php
385
     */
385
     */
386
    public function test_mixedhostiplist() {
386
    public function test_mixedhostiplist(): void {
387
        $this->resetAfterTest();
387
        $this->resetAfterTest();
Línea 388... Línea 388...
388
 
388
 
Línea 389... Línea 389...
389
        $adminsetting = new admin_setting_configmixedhostiplist('abc_cde/hostiplist', 'some desc', '', '');
389
        $adminsetting = new admin_setting_configmixedhostiplist('abc_cde/hostiplist', 'some desc', '', '');
Línea 432... Línea 432...
432
    }
432
    }
Línea 433... Línea 433...
433
 
433
 
434
    /**
434
    /**
435
     * Verifies the $ADMIN global (adminroot cache) is properly reset when changing users, which might occur naturally during cron.
435
     * Verifies the $ADMIN global (adminroot cache) is properly reset when changing users, which might occur naturally during cron.
436
     */
436
     */
437
    public function test_adminroot_cache_reset() {
437
    public function test_adminroot_cache_reset(): void {
438
        $this->resetAfterTest();
438
        $this->resetAfterTest();
439
        global $DB;
439
        global $DB;
440
        // Current user is a manager at site context, which won't have access to the 'debugging' section of the admin tree.
440
        // Current user is a manager at site context, which won't have access to the 'debugging' section of the admin tree.
441
        $manageruser = $this->getDataGenerator()->create_user();
441
        $manageruser = $this->getDataGenerator()->create_user();