Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 31... Línea 31...
31
class system_test extends \advanced_testcase {
31
class system_test extends \advanced_testcase {
32
    /**
32
    /**
33
     * Tests legacy class.
33
     * Tests legacy class.
34
     * @coversNothing
34
     * @coversNothing
35
     */
35
     */
36
    public function test_legacy_classname() {
36
    public function test_legacy_classname(): void {
37
        $context = \context_system::instance();
37
        $context = \context_system::instance();
38
        $this->assertInstanceOf(system::class, $context);
38
        $this->assertInstanceOf(system::class, $context);
39
        $this->assertInstanceOf(\context_system::class, $context);
39
        $this->assertInstanceOf(\context_system::class, $context);
40
    }
40
    }
Línea 41... Línea 41...
41
 
41
 
42
    /**
42
    /**
43
     * Tests covered methods.
43
     * Tests covered methods.
44
     * @covers ::instance
44
     * @covers ::instance
45
     * @covers \core\context::instance_by_id
45
     * @covers \core\context::instance_by_id
46
     */
46
     */
47
    public function test_factory_methods() {
47
    public function test_factory_methods(): void {
48
        $context = system::instance();
48
        $context = system::instance();
49
        $this->assertInstanceOf(system::class, $context);
49
        $this->assertInstanceOf(system::class, $context);
Línea 50... Línea 50...
50
        $this->assertEquals(SYSCONTEXTID, $context->id);
50
        $this->assertEquals(SYSCONTEXTID, $context->id);
Línea 56... Línea 56...
56
 
56
 
57
    /**
57
    /**
58
     * Tests covered method.
58
     * Tests covered method.
59
     * @covers ::get_short_name
59
     * @covers ::get_short_name
60
     */
60
     */
61
    public function test_get_short_name() {
61
    public function test_get_short_name(): void {
62
        $this->assertSame('system', system::get_short_name());
62
        $this->assertSame('system', system::get_short_name());
Línea 63... Línea 63...
63
    }
63
    }
64
 
64
 
65
    /**
65
    /**
66
     * Tests context level.
66
     * Tests context level.
67
     * @coversNothing
67
     * @coversNothing
68
     */
68
     */
69
    public function test_level() {
69
    public function test_level(): void {
70
        $this->assertSame(10, system::LEVEL);
70
        $this->assertSame(10, system::LEVEL);
Línea 71... Línea 71...
71
        $this->assertSame(CONTEXT_SYSTEM, system::LEVEL);
71
        $this->assertSame(CONTEXT_SYSTEM, system::LEVEL);
72
    }
72
    }
73
 
73
 
74
    /**
74
    /**
75
     * Tests covered method.
75
     * Tests covered method.
76
     * @covers ::get_level_name
76
     * @covers ::get_level_name
77
     */
77
     */
Línea 78... Línea 78...
78
    public function test_get_level_name() {
78
    public function test_get_level_name(): void {
79
        $this->assertSame('System', system::get_level_name());
79
        $this->assertSame('System', system::get_level_name());
80
    }
80
    }
81
 
81
 
82
    /**
82
    /**
83
     * Tests covered method.
83
     * Tests covered method.
84
     * @covers ::get_context_name
84
     * @covers ::get_context_name
85
     */
85
     */
86
    public function test_get_context_name() {
86
    public function test_get_context_name(): void {
87
        $context = system::instance();
87
        $context = system::instance();
Línea 94... Línea 94...
94
 
94
 
95
    /**
95
    /**
96
     * Tests covered method.
96
     * Tests covered method.
97
     * @covers ::get_url
97
     * @covers ::get_url
98
     */
98
     */
99
    public function test_get_url() {
99
    public function test_get_url(): void {
100
        $context = system::instance();
100
        $context = system::instance();
101
        $expected = new \moodle_url('/');
101
        $expected = new \moodle_url('/');
102
        $url = $context->get_url();
102
        $url = $context->get_url();
103
        $this->assertInstanceOf(\moodle_url::class, $url);
103
        $this->assertInstanceOf(\moodle_url::class, $url);
Línea 106... Línea 106...
106
 
106
 
107
    /**
107
    /**
108
     * Tests covered method.
108
     * Tests covered method.
109
     * @covers \core\context_helper::resolve_behat_reference
109
     * @covers \core\context_helper::resolve_behat_reference
110
     */
110
     */
111
    public function test_resolve_behat_reference() {
111
    public function test_resolve_behat_reference(): void {
Línea 112... Línea 112...
112
        $syscontext = context\system::instance();
112
        $syscontext = context\system::instance();
113
 
113
 
Línea 126... Línea 126...
126
 
126
 
127
    /**
127
    /**
128
     * Tests covered method.
128
     * Tests covered method.
129
     * @covers ::get_compatible_role_archetypes
129
     * @covers ::get_compatible_role_archetypes
130
     */
130
     */
131
    public function test_get_compatible_role_archetypes() {
131
    public function test_get_compatible_role_archetypes(): void {
Línea 132... Línea 132...
132
        global $DB;
132
        global $DB;
133
 
133
 
134
        $allarchetypes = $DB->get_fieldset_select('role', 'DISTINCT archetype', 'archetype IS NOT NULL');
134
        $allarchetypes = $DB->get_fieldset_select('role', 'DISTINCT archetype', 'archetype IS NOT NULL');
Línea 144... Línea 144...
144
 
144
 
145
    /**
145
    /**
146
     * Tests covered method.
146
     * Tests covered method.
147
     * @covers ::get_possible_parent_levels
147
     * @covers ::get_possible_parent_levels
148
     */
148
     */
149
    public function test_get_possible_parent_levels() {
149
    public function test_get_possible_parent_levels(): void {
150
        $this->assertSame([], system::get_possible_parent_levels());
150
        $this->assertSame([], system::get_possible_parent_levels());
Línea 151... Línea 151...
151
    }
151
    }
152
 
152
 
153
    /**
153
    /**
154
     * Tests covered method.
154
     * Tests covered method.
155
     * @covers ::get_capabilities
155
     * @covers ::get_capabilities
156
     */
156
     */
Línea 157... Línea 157...
157
    public function test_get_capabilities() {
157
    public function test_get_capabilities(): void {
158
        global $DB;
158
        global $DB;
159
 
159
 
Línea 165... Línea 165...
165
 
165
 
166
    /**
166
    /**
167
     * Tests covered method.
167
     * Tests covered method.
168
     * @covers ::create_level_instances
168
     * @covers ::create_level_instances
169
     */
169
     */
170
    public function test_create_level_instances() {
170
    public function test_create_level_instances(): void {
171
        context_helper::create_instances(system::LEVEL);
171
        context_helper::create_instances(system::LEVEL);
Línea 172... Línea 172...
172
    }
172
    }
173
 
173
 
174
    /**
174
    /**
175
     * Tests covered method.
175
     * Tests covered method.
176
     * @covers ::get_child_contexts
176
     * @covers ::get_child_contexts
177
     */
177
     */
Línea 178... Línea 178...
178
    public function test_get_child_contexts() {
178
    public function test_get_child_contexts(): void {
179
        global $DB;
179
        global $DB;
180
 
180
 
Línea 188... Línea 188...
188
 
188
 
189
    /**
189
    /**
190
     * Tests covered method.
190
     * Tests covered method.
191
     * @covers ::get_cleanup_sql
191
     * @covers ::get_cleanup_sql
192
     */
192
     */
193
    public function test_get_cleanup_sql() {
193
    public function test_get_cleanup_sql(): void {
194
        // Nothing to clean up actually.
194
        // Nothing to clean up actually.
195
        context_helper::cleanup_instances();
195
        context_helper::cleanup_instances();
Línea 196... Línea 196...
196
    }
196
    }
197
 
197
 
198
    /**
198
    /**
199
     * Tests covered method.
199
     * Tests covered method.
200
     * @covers ::build_paths
200
     * @covers ::build_paths
201
     */
201
     */
202
    public function test_build_paths() {
202
    public function test_build_paths(): void {
Línea 203... Línea 203...
203
        global $DB;
203
        global $DB;
204
        $this->resetAfterTest();
204
        $this->resetAfterTest();
Línea 215... Línea 215...
215
 
215
 
216
    /**
216
    /**
217
     * Tests covered method.
217
     * Tests covered method.
218
     * @covers ::set_locked
218
     * @covers ::set_locked
219
     */
219
     */
220
    public function test_set_locked() {
220
    public function test_set_locked(): void {
Línea 221... Línea 221...
221
        $context = system::instance();
221
        $context = system::instance();
Línea 222... Línea 222...
222
 
222