Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 61... Línea 61...
61
 
61
 
62
        $this->model = testable_model::create($target, $indicators);
62
        $this->model = testable_model::create($target, $indicators);
63
        $this->modelobj = $this->model->get_model_obj();
63
        $this->modelobj = $this->model->get_model_obj();
Línea 64... Línea 64...
64
    }
64
    }
65
 
65
 
Línea 66... Línea 66...
66
    public function test_enable() {
66
    public function test_enable(): void {
67
        $this->resetAfterTest(true);
67
        $this->resetAfterTest(true);
68
 
68
 
Línea 74... Línea 74...
74
        $this->assertEquals(1, $this->model->get_model_obj()->enabled);
74
        $this->assertEquals(1, $this->model->get_model_obj()->enabled);
75
        $this->assertEquals(0, $this->model->get_model_obj()->trained);
75
        $this->assertEquals(0, $this->model->get_model_obj()->trained);
76
        $this->assertEquals('\core\analytics\time_splitting\quarters', $this->model->get_model_obj()->timesplitting);
76
        $this->assertEquals('\core\analytics\time_splitting\quarters', $this->model->get_model_obj()->timesplitting);
77
    }
77
    }
Línea 78... Línea 78...
78
 
78
 
79
    public function test_create() {
79
    public function test_create(): void {
Línea 80... Línea 80...
80
        $this->resetAfterTest(true);
80
        $this->resetAfterTest(true);
81
 
81
 
82
        $target = \core_analytics\manager::get_target('\core_course\analytics\target\course_dropout');
82
        $target = \core_analytics\manager::get_target('\core_course\analytics\target\course_dropout');
Línea 89... Línea 89...
89
    }
89
    }
Línea 90... Línea 90...
90
 
90
 
91
    /**
91
    /**
92
     * test_delete
92
     * test_delete
93
     */
93
     */
94
    public function test_delete() {
94
    public function test_delete(): void {
Línea 95... Línea 95...
95
        global $DB;
95
        global $DB;
96
 
96
 
Línea 134... Línea 134...
134
    }
134
    }
Línea 135... Línea 135...
135
 
135
 
136
    /**
136
    /**
137
     * test_clear
137
     * test_clear
138
     */
138
     */
139
    public function test_clear() {
139
    public function test_clear(): void {
Línea 140... Línea 140...
140
        global $DB;
140
        global $DB;
141
 
141
 
Línea 185... Línea 185...
185
    }
185
    }
Línea 186... Línea 186...
186
 
186
 
187
    /**
187
    /**
188
     * Test behaviour of {\core_analytics\model::clear()} for static models.
188
     * Test behaviour of {\core_analytics\model::clear()} for static models.
189
     */
189
     */
190
    public function test_clear_static() {
190
    public function test_clear_static(): void {
191
        global $DB;
191
        global $DB;
Línea 192... Línea 192...
192
        $this->resetAfterTest();
192
        $this->resetAfterTest();
193
 
193
 
Línea 203... Línea 203...
203
 
203
 
204
        // Check that the model is still marked as trained even after clearing.
204
        // Check that the model is still marked as trained even after clearing.
205
        $this->assertEquals(1, $DB->get_field('analytics_models', 'trained', array('id' => $modelobj->id)));
205
        $this->assertEquals(1, $DB->get_field('analytics_models', 'trained', array('id' => $modelobj->id)));
Línea 206... Línea 206...
206
    }
206
    }
207
 
207
 
Línea 208... Línea 208...
208
    public function test_model_manager() {
208
    public function test_model_manager(): void {
209
        $this->resetAfterTest(true);
209
        $this->resetAfterTest(true);
Línea 217... Línea 217...
217
 
217
 
218
        $this->model->enable('\core\analytics\time_splitting\quarters');
218
        $this->model->enable('\core\analytics\time_splitting\quarters');
219
        $this->assertInstanceOf('\core\analytics\analyser\site_courses', $this->model->get_analyser());
219
        $this->assertInstanceOf('\core\analytics\analyser\site_courses', $this->model->get_analyser());
Línea 220... Línea 220...
220
    }
220
    }
221
 
221
 
Línea 222... Línea 222...
222
    public function test_output_dir() {
222
    public function test_output_dir(): void {
223
        $this->resetAfterTest(true);
223
        $this->resetAfterTest(true);
Línea 224... Línea 224...
224
 
224
 
225
        $dir = make_request_directory();
225
        $dir = make_request_directory();
226
        set_config('modeloutputdir', $dir, 'analytics');
226
        set_config('modeloutputdir', $dir, 'analytics');
227
 
227
 
Línea 228... Línea 228...
228
        $modeldir = $dir . DIRECTORY_SEPARATOR . $this->modelobj->id . DIRECTORY_SEPARATOR . $this->modelobj->version;
228
        $modeldir = $dir . DIRECTORY_SEPARATOR . $this->modelobj->id . DIRECTORY_SEPARATOR . $this->modelobj->version;
229
        $this->assertEquals($modeldir, $this->model->get_output_dir());
229
        $this->assertEquals($modeldir, $this->model->get_output_dir());
Línea 230... Línea 230...
230
        $this->assertEquals($modeldir . DIRECTORY_SEPARATOR . 'testing', $this->model->get_output_dir(array('testing')));
230
        $this->assertEquals($modeldir . DIRECTORY_SEPARATOR . 'testing', $this->model->get_output_dir(array('testing')));
Línea 231... Línea 231...
231
    }
231
    }
Línea 275... Línea 275...
275
    /**
275
    /**
276
     * test_exists
276
     * test_exists
277
     *
277
     *
278
     * @return void
278
     * @return void
279
     */
279
     */
280
    public function test_exists() {
280
    public function test_exists(): void {
281
        $this->resetAfterTest(true);
281
        $this->resetAfterTest(true);
Línea 282... Línea 282...
282
 
282
 
283
        $target = \core_analytics\manager::get_target('\core_course\analytics\target\no_teaching');
283
        $target = \core_analytics\manager::get_target('\core_course\analytics\target\no_teaching');
Línea 293... Línea 293...
293
    /**
293
    /**
294
     * test_model_timelimit
294
     * test_model_timelimit
295
     *
295
     *
296
     * @return null
296
     * @return null
297
     */
297
     */
298
    public function test_model_timelimit() {
298
    public function test_model_timelimit(): void {
299
        global $DB;
299
        global $DB;
Línea 300... Línea 300...
300
 
300
 
Línea 301... Línea 301...
301
        $this->resetAfterTest(true);
301
        $this->resetAfterTest(true);
Línea 357... Línea 357...
357
    }
357
    }
Línea 358... Línea 358...
358
 
358
 
359
    /**
359
    /**
360
     * Test model_config::get_class_component.
360
     * Test model_config::get_class_component.
361
     */
361
     */
362
    public function test_model_config_get_class_component() {
362
    public function test_model_config_get_class_component(): void {
Línea 363... Línea 363...
363
        $this->resetAfterTest(true);
363
        $this->resetAfterTest(true);
364
 
364
 
365
        $this->assertEquals('core',
365
        $this->assertEquals('core',
Línea 375... Línea 375...
375
    }
375
    }
Línea 376... Línea 376...
376
 
376
 
377
    /**
377
    /**
378
     * Test that import_model import models' configurations.
378
     * Test that import_model import models' configurations.
379
     */
379
     */
380
    public function test_import_model_config() {
380
    public function test_import_model_config(): void {
Línea 381... Línea 381...
381
        $this->resetAfterTest(true);
381
        $this->resetAfterTest(true);
382
 
382
 
Línea 396... Línea 396...
396
    }
396
    }
Línea 397... Línea 397...
397
 
397
 
398
    /**
398
    /**
399
     * Test can export configuration
399
     * Test can export configuration
400
     */
400
     */
401
    public function test_can_export_configuration() {
401
    public function test_can_export_configuration(): void {
Línea 402... Línea 402...
402
        $this->resetAfterTest(true);
402
        $this->resetAfterTest(true);
403
 
403
 
Línea 417... Línea 417...
417
    }
417
    }
Línea 418... Línea 418...
418
 
418
 
419
    /**
419
    /**
420
     * Test export_config
420
     * Test export_config
421
     */
421
     */
422
    public function test_export_config() {
422
    public function test_export_config(): void {
Línea 423... Línea 423...
423
        $this->resetAfterTest(true);
423
        $this->resetAfterTest(true);
Línea 424... Línea 424...
424
 
424
 
Línea 445... Línea 445...
445
    }
445
    }
Línea 446... Línea 446...
446
 
446
 
447
    /**
447
    /**
448
     * Test the implementation of {@link \core_analytics\model::inplace_editable_name()}.
448
     * Test the implementation of {@link \core_analytics\model::inplace_editable_name()}.
449
     */
449
     */
450
    public function test_inplace_editable_name() {
450
    public function test_inplace_editable_name(): void {
Línea 451... Línea 451...
451
        global $PAGE;
451
        global $PAGE;
Línea 452... Línea 452...
452
 
452
 
Línea 471... Línea 471...
471
    }
471
    }
Línea 472... Línea 472...
472
 
472
 
473
    /**
473
    /**
474
     * Test how the models present themselves in the UI and that they can be renamed.
474
     * Test how the models present themselves in the UI and that they can be renamed.
475
     */
475
     */
476
    public function test_get_name_and_rename() {
476
    public function test_get_name_and_rename(): void {
Línea 477... Línea 477...
477
        global $PAGE;
477
        global $PAGE;
Línea 478... Línea 478...
478
 
478
 
Línea 502... Línea 502...
502
    }
502
    }
Línea 503... Línea 503...
503
 
503
 
504
    /**
504
    /**
505
     * Tests model::get_potential_timesplittings()
505
     * Tests model::get_potential_timesplittings()
506
     */
506
     */
507
    public function test_potential_timesplittings() {
507
    public function test_potential_timesplittings(): void {
Línea 508... Línea 508...
508
        $this->resetAfterTest();
508
        $this->resetAfterTest();
509
 
509
 
510
        $this->assertArrayNotHasKey('\core\analytics\time_splitting\no_splitting', $this->model->get_potential_timesplittings());
510
        $this->assertArrayNotHasKey('\core\analytics\time_splitting\no_splitting', $this->model->get_potential_timesplittings());
Línea 515... Línea 515...
515
    /**
515
    /**
516
     * Tests model::get_samples()
516
     * Tests model::get_samples()
517
     *
517
     *
518
     * @return null
518
     * @return null
519
     */
519
     */
520
    public function test_get_samples() {
520
    public function test_get_samples(): void {
521
        $this->resetAfterTest();
521
        $this->resetAfterTest();
Línea 522... Línea 522...
522
 
522
 
523
        if (!PHPUNIT_LONGTEST) {
523
        if (!PHPUNIT_LONGTEST) {
524
            $this->markTestSkipped('PHPUNIT_LONGTEST is not defined');
524
            $this->markTestSkipped('PHPUNIT_LONGTEST is not defined');