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 module_test extends \advanced_testcase {
31
class module_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
        $this->resetAfterTest();
37
        $this->resetAfterTest();
Línea 38... Línea 38...
38
 
38
 
39
        $course = $this->getDataGenerator()->create_course();
39
        $course = $this->getDataGenerator()->create_course();
40
        $page = $this->getDataGenerator()->create_module('page', ['course' => $course->id]);
40
        $page = $this->getDataGenerator()->create_module('page', ['course' => $course->id]);
Línea 47... Línea 47...
47
    /**
47
    /**
48
     * Tests covered methods.
48
     * Tests covered methods.
49
     * @covers ::instance
49
     * @covers ::instance
50
     * @covers \core\context::instance_by_id
50
     * @covers \core\context::instance_by_id
51
     */
51
     */
52
    public function test_factory_methods() {
52
    public function test_factory_methods(): void {
53
        $this->resetAfterTest();
53
        $this->resetAfterTest();
Línea 54... Línea 54...
54
 
54
 
55
        $course = $this->getDataGenerator()->create_course();
55
        $course = $this->getDataGenerator()->create_course();
56
        $page = $this->getDataGenerator()->create_module('page', ['course' => $course->id]);
56
        $page = $this->getDataGenerator()->create_module('page', ['course' => $course->id]);
Línea 66... Línea 66...
66
 
66
 
67
    /**
67
    /**
68
     * Tests covered method.
68
     * Tests covered method.
69
     * @covers ::get_short_name
69
     * @covers ::get_short_name
70
     */
70
     */
71
    public function test_get_short_name() {
71
    public function test_get_short_name(): void {
72
        $this->assertSame('module', module::get_short_name());
72
        $this->assertSame('module', module::get_short_name());
Línea 73... Línea 73...
73
    }
73
    }
74
 
74
 
75
    /**
75
    /**
76
     * Tests context level.
76
     * Tests context level.
77
     * @coversNothing
77
     * @coversNothing
78
     */
78
     */
79
    public function test_level() {
79
    public function test_level(): void {
80
        $this->assertSame(70, module::LEVEL);
80
        $this->assertSame(70, module::LEVEL);
Línea 81... Línea 81...
81
        $this->assertSame(CONTEXT_MODULE, module::LEVEL);
81
        $this->assertSame(CONTEXT_MODULE, module::LEVEL);
82
    }
82
    }
83
 
83
 
84
    /**
84
    /**
85
     * Tests covered method.
85
     * Tests covered method.
86
     * @covers ::get_level_name
86
     * @covers ::get_level_name
87
     */
87
     */
Línea 88... Línea 88...
88
    public function test_get_level_name() {
88
    public function test_get_level_name(): void {
89
        $this->assertSame('Activity module', module::get_level_name());
89
        $this->assertSame('Activity module', module::get_level_name());
90
    }
90
    }
91
 
91
 
92
    /**
92
    /**
93
     * Tests covered method.
93
     * Tests covered method.
Línea 94... Línea 94...
94
     * @covers ::get_context_name
94
     * @covers ::get_context_name
95
     */
95
     */
96
    public function test_get_context_name() {
96
    public function test_get_context_name(): void {
Línea 109... Línea 109...
109
 
109
 
110
    /**
110
    /**
111
     * Tests covered method.
111
     * Tests covered method.
112
     * @covers ::get_url
112
     * @covers ::get_url
113
     */
113
     */
114
    public function test_get_url() {
114
    public function test_get_url(): void {
Línea 115... Línea 115...
115
        $this->resetAfterTest();
115
        $this->resetAfterTest();
116
 
116
 
117
        $course = $this->getDataGenerator()->create_course();
117
        $course = $this->getDataGenerator()->create_course();
Línea 128... Línea 128...
128
     * Tests covered methods.
128
     * Tests covered methods.
129
     * @covers ::get_instance_table()
129
     * @covers ::get_instance_table()
130
     * @covers ::get_behat_reference_columns()
130
     * @covers ::get_behat_reference_columns()
131
     * @covers \core\context_helper::resolve_behat_reference
131
     * @covers \core\context_helper::resolve_behat_reference
132
     */
132
     */
133
    public function test_resolve_behat_reference() {
133
    public function test_resolve_behat_reference(): void {
134
        global $DB;
134
        global $DB;
135
        $this->resetAfterTest();
135
        $this->resetAfterTest();
Línea 136... Línea 136...
136
 
136
 
137
        $course = $this->getDataGenerator()->create_course();
137
        $course = $this->getDataGenerator()->create_course();
Línea 157... Línea 157...
157
 
157
 
158
    /**
158
    /**
159
     * Tests covered method.
159
     * Tests covered method.
160
     * @covers ::get_compatible_role_archetypes
160
     * @covers ::get_compatible_role_archetypes
161
     */
161
     */
162
    public function test_get_compatible_role_archetypes() {
162
    public function test_get_compatible_role_archetypes(): void {
Línea 163... Línea 163...
163
        global $DB;
163
        global $DB;
164
 
164
 
165
        $allarchetypes = $DB->get_fieldset_select('role', 'DISTINCT archetype', 'archetype IS NOT NULL');
165
        $allarchetypes = $DB->get_fieldset_select('role', 'DISTINCT archetype', 'archetype IS NOT NULL');
Línea 175... Línea 175...
175
 
175
 
176
    /**
176
    /**
177
     * Tests covered method.
177
     * Tests covered method.
178
     * @covers ::get_possible_parent_levels
178
     * @covers ::get_possible_parent_levels
179
     */
179
     */
180
    public function test_get_possible_parent_levels() {
180
    public function test_get_possible_parent_levels(): void {
181
        $this->assertSame([course::LEVEL], module::get_possible_parent_levels());
181
        $this->assertSame([course::LEVEL], module::get_possible_parent_levels());
Línea 182... Línea 182...
182
    }
182
    }
183
 
183
 
184
    /**
184
    /**
185
     * Tests covered method.
185
     * Tests covered method.
186
     * @covers ::get_capabilities
186
     * @covers ::get_capabilities
187
     */
187
     */
Línea 188... Línea 188...
188
    public function test_get_capabilities() {
188
    public function test_get_capabilities(): void {
189
        $this->resetAfterTest();
189
        $this->resetAfterTest();
190
 
190
 
Línea 204... Línea 204...
204
 
204
 
205
    /**
205
    /**
206
     * Tests covered method.
206
     * Tests covered method.
207
     * @covers ::create_level_instances
207
     * @covers ::create_level_instances
208
     */
208
     */
209
    public function test_create_level_instances() {
209
    public function test_create_level_instances(): void {
210
        global $DB;
210
        global $DB;
Línea 211... Línea 211...
211
        $this->resetAfterTest();
211
        $this->resetAfterTest();
212
 
212
 
Línea 221... Línea 221...
221
 
221
 
222
    /**
222
    /**
223
     * Tests covered method.
223
     * Tests covered method.
224
     * @covers ::get_child_contexts
224
     * @covers ::get_child_contexts
225
     */
225
     */
226
    public function test_get_child_contexts() {
226
    public function test_get_child_contexts(): void {
Línea 227... Línea 227...
227
        $this->resetAfterTest();
227
        $this->resetAfterTest();
228
 
228
 
229
        $course = $this->getDataGenerator()->create_course();
229
        $course = $this->getDataGenerator()->create_course();
Línea 236... Línea 236...
236
 
236
 
237
    /**
237
    /**
238
     * Tests covered method.
238
     * Tests covered method.
239
     * @covers ::get_cleanup_sql
239
     * @covers ::get_cleanup_sql
240
     */
240
     */
241
    public function test_get_cleanup_sql() {
241
    public function test_get_cleanup_sql(): void {
242
        global $DB;
242
        global $DB;
Línea 243... Línea 243...
243
        $this->resetAfterTest();
243
        $this->resetAfterTest();
244
 
244
 
Línea 255... Línea 255...
255
 
255
 
256
    /**
256
    /**
257
     * Tests covered method.
257
     * Tests covered method.
258
     * @covers ::build_paths
258
     * @covers ::build_paths
259
     */
259
     */
260
    public function test_build_paths() {
260
    public function test_build_paths(): void {
261
        global $DB;
261
        global $DB;
Línea 262... Línea 262...
262
        $this->resetAfterTest();
262
        $this->resetAfterTest();
263
 
263
 
Línea 281... Línea 281...
281
 
281
 
282
    /**
282
    /**
283
     * Tests covered method.
283
     * Tests covered method.
284
     * @covers ::set_locked
284
     * @covers ::set_locked
285
     */
285
     */
286
    public function test_set_locked() {
286
    public function test_set_locked(): void {
287
        global $DB;
287
        global $DB;
Línea 288... Línea 288...
288
        $this->resetAfterTest();
288
        $this->resetAfterTest();
289
 
289