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
     * Confirms that completionentries is working
61
     * Confirms that completionentries is working
62
     * Sets it to 1, confirms that
62
     * Sets it to 1, confirms that
63
     * it is not complete. Inserts a record and
63
     * it is not complete. Inserts a record and
64
     * confirms that it is complete.
64
     * confirms that it is complete.
65
     */
65
     */
66
    public function test_data_completion() {
66
    public function test_data_completion(): void {
67
        global $DB, $CFG;
67
        global $DB, $CFG;
68
        $this->resetAfterTest();
68
        $this->resetAfterTest();
69
        $this->setAdminUser();
69
        $this->setAdminUser();
70
        $CFG->enablecompletion = 1;
70
        $CFG->enablecompletion = 1;
71
        $course = $this->getDataGenerator()->create_course(array('enablecompletion' => 1));
71
        $course = $this->getDataGenerator()->create_course(array('enablecompletion' => 1));
Línea 109... Línea 109...
109
        $completiondata = $completion->get_data($cm);
109
        $completiondata = $completion->get_data($cm);
110
        /* Confirm it is complete because it has 1 entry */
110
        /* Confirm it is complete because it has 1 entry */
111
        $this->assertEquals(1, $completiondata->completionstate);
111
        $this->assertEquals(1, $completiondata->completionstate);
112
    }
112
    }
Línea 113... Línea 113...
113
 
113
 
114
    public function test_data_delete_record() {
114
    public function test_data_delete_record(): void {
Línea 115... Línea 115...
115
        global $DB;
115
        global $DB;
Línea 116... Línea 116...
116
 
116
 
Línea 180... Línea 180...
180
    }
180
    }
Línea 181... Línea 181...
181
 
181
 
182
    /**
182
    /**
183
     * Test comment_created event.
183
     * Test comment_created event.
184
     */
184
     */
185
    public function test_data_comment_created_event() {
185
    public function test_data_comment_created_event(): void {
186
        global $CFG, $DB;
186
        global $CFG, $DB;
Línea 187... Línea 187...
187
        require_once($CFG->dirroot . '/comment/lib.php');
187
        require_once($CFG->dirroot . '/comment/lib.php');
Línea 243... Línea 243...
243
    }
243
    }
Línea 244... Línea 244...
244
 
244
 
245
    /**
245
    /**
246
     * Test comment_deleted event.
246
     * Test comment_deleted event.
247
     */
247
     */
248
    public function test_data_comment_deleted_event() {
248
    public function test_data_comment_deleted_event(): void {
249
        global $CFG, $DB;
249
        global $CFG, $DB;
Línea 250... Línea 250...
250
        require_once($CFG->dirroot . '/comment/lib.php');
250
        require_once($CFG->dirroot . '/comment/lib.php');
Línea 308... Línea 308...
308
 
308
 
309
    /**
309
    /**
310
     * Checks that data_user_can_manage_entry will return true if the user
310
     * Checks that data_user_can_manage_entry will return true if the user
311
     * has the mod/data:manageentries capability.
311
     * has the mod/data:manageentries capability.
312
     */
312
     */
Línea 313... Línea 313...
313
    public function test_data_user_can_manage_entry_return_true_with_capability() {
313
    public function test_data_user_can_manage_entry_return_true_with_capability(): void {
314
 
314
 
Línea 315... Línea 315...
315
        $this->resetAfterTest();
315
        $this->resetAfterTest();
Línea 332... Línea 332...
332
 
332
 
333
    /**
333
    /**
334
     * Checks that data_user_can_manage_entry will return false if the data
334
     * Checks that data_user_can_manage_entry will return false if the data
335
     * is set to readonly.
335
     * is set to readonly.
336
     */
336
     */
Línea 337... Línea 337...
337
    public function test_data_user_can_manage_entry_return_false_readonly() {
337
    public function test_data_user_can_manage_entry_return_false_readonly(): void {
338
 
338
 
Línea 339... Línea 339...
339
        $this->resetAfterTest();
339
        $this->resetAfterTest();
Línea 364... Línea 364...
364
 
364
 
365
    /**
365
    /**
366
     * Checks that data_user_can_manage_entry will return false if the record
366
     * Checks that data_user_can_manage_entry will return false if the record
367
     * can't be found in the database.
367
     * can't be found in the database.
368
     */
368
     */
Línea 369... Línea 369...
369
    public function test_data_user_can_manage_entry_return_false_no_record() {
369
    public function test_data_user_can_manage_entry_return_false_no_record(): void {
370
 
370
 
Línea 371... Línea 371...
371
        $this->resetAfterTest();
371
        $this->resetAfterTest();
Línea 395... Línea 395...
395
 
395
 
396
    /**
396
    /**
397
     * Checks that data_user_can_manage_entry will return false if the record
397
     * Checks that data_user_can_manage_entry will return false if the record
398
     * isn't owned by the user.
398
     * isn't owned by the user.
399
     */
399
     */
Línea 400... Línea 400...
400
    public function test_data_user_can_manage_entry_return_false_not_owned_record() {
400
    public function test_data_user_can_manage_entry_return_false_not_owned_record(): void {
401
 
401
 
Línea 402... Línea 402...
402
        $this->resetAfterTest();
402
        $this->resetAfterTest();
Línea 427... Línea 427...
427
 
427
 
428
    /**
428
    /**
429
     * Checks that data_user_can_manage_entry will return true if the data
429
     * Checks that data_user_can_manage_entry will return true if the data
430
     * doesn't require approval.
430
     * doesn't require approval.
431
     */
431
     */
Línea 432... Línea 432...
432
    public function test_data_user_can_manage_entry_return_true_data_no_approval() {
432
    public function test_data_user_can_manage_entry_return_true_data_no_approval(): void {
433
 
433
 
Línea 434... Línea 434...
434
        $this->resetAfterTest();
434
        $this->resetAfterTest();
Línea 461... Línea 461...
461
 
461
 
462
    /**
462
    /**
463
     * Checks that data_user_can_manage_entry will return true if the record
463
     * Checks that data_user_can_manage_entry will return true if the record
464
     * isn't yet approved.
464
     * isn't yet approved.
465
     */
465
     */
Línea 466... Línea 466...
466
    public function test_data_user_can_manage_entry_return_true_record_unapproved() {
466
    public function test_data_user_can_manage_entry_return_true_record_unapproved(): void {
467
 
467
 
Línea 468... Línea 468...
468
        $this->resetAfterTest();
468
        $this->resetAfterTest();
Línea 497... Línea 497...
497
 
497
 
498
    /**
498
    /**
499
     * Checks that data_user_can_manage_entry will return the 'manageapproved'
499
     * Checks that data_user_can_manage_entry will return the 'manageapproved'
500
     * value if the record has already been approved.
500
     * value if the record has already been approved.
501
     */
501
     */
Línea 502... Línea 502...
502
    public function test_data_user_can_manage_entry_return_manageapproved() {
502
    public function test_data_user_can_manage_entry_return_manageapproved(): void {
503
 
503
 
Línea 504... Línea 504...
504
        $this->resetAfterTest();
504
        $this->resetAfterTest();
Línea 573... Línea 573...
573
     * Tests for mod_data_rating_can_see_item_ratings().
573
     * Tests for mod_data_rating_can_see_item_ratings().
574
     *
574
     *
575
     * @throws coding_exception
575
     * @throws coding_exception
576
     * @throws rating_exception
576
     * @throws rating_exception
577
     */
577
     */
578
    public function test_mod_data_rating_can_see_item_ratings() {
578
    public function test_mod_data_rating_can_see_item_ratings(): void {
579
        global $DB;
579
        global $DB;
Línea 580... Línea 580...
580
 
580
 
Línea 581... Línea 581...
581
        $this->resetAfterTest();
581
        $this->resetAfterTest();
Línea 699... Línea 699...
699
    }
699
    }
Línea 700... Línea 700...
700
 
700
 
701
    /**
701
    /**
702
     * Tests for mod_data_refresh_events.
702
     * Tests for mod_data_refresh_events.
703
     */
703
     */
704
    public function test_data_refresh_events() {
704
    public function test_data_refresh_events(): void {
705
        global $DB;
705
        global $DB;
706
        $this->resetAfterTest();
706
        $this->resetAfterTest();
Línea 707... Línea 707...
707
        $this->setAdminUser();
707
        $this->setAdminUser();
Línea 826... Línea 826...
826
     *
826
     *
827
     * @dataProvider    data_get_config_provider
827
     * @dataProvider    data_get_config_provider
828
     * @param   array   $funcargs       The args to pass to data_get_config
828
     * @param   array   $funcargs       The args to pass to data_get_config
829
     * @param   mixed   $expectation    The expected value
829
     * @param   mixed   $expectation    The expected value
830
     */
830
     */
831
    public function test_data_get_config($funcargs, $expectation) {
831
    public function test_data_get_config($funcargs, $expectation): void {
832
        $this->assertEquals($expectation, call_user_func_array('data_get_config', $funcargs));
832
        $this->assertEquals($expectation, call_user_func_array('data_get_config', $funcargs));
833
    }
833
    }
Línea 834... Línea 834...
834
 
834
 
835
    /**
835
    /**
Línea 908... Línea 908...
908
     * @param   string  $key            The config key to set
908
     * @param   string  $key            The config key to set
909
     * @param   mixed   $value          The value of the key
909
     * @param   mixed   $value          The value of the key
910
     * @param   bool    $expectupdate   Whether we expected an update
910
     * @param   bool    $expectupdate   Whether we expected an update
911
     * @param   mixed   $newconfigvalue The expected value
911
     * @param   mixed   $newconfigvalue The expected value
912
     */
912
     */
913
    public function test_data_set_config($database, $key, $value, $expectupdate, $newconfigvalue) {
913
    public function test_data_set_config($database, $key, $value, $expectupdate, $newconfigvalue): void {
914
        global $DB;
914
        global $DB;
Línea 915... Línea 915...
915
 
915
 
916
        // Mock the database.
916
        // Mock the database.
917
        // Note: Use the actual test class here rather than the abstract because are testing concrete methods.
917
        // Note: Use the actual test class here rather than the abstract because are testing concrete methods.
Línea 935... Línea 935...
935
        // Ensure that the value was updated by reference in $database.
935
        // Ensure that the value was updated by reference in $database.
936
        $config = json_decode($database->config);
936
        $config = json_decode($database->config);
937
        $this->assertEquals($value, $config->$key);
937
        $this->assertEquals($value, $config->$key);
938
    }
938
    }
Línea 939... Línea 939...
939
 
939
 
940
    public function test_mod_data_get_tagged_records() {
940
    public function test_mod_data_get_tagged_records(): void {
941
        $this->resetAfterTest();
941
        $this->resetAfterTest();
Línea 942... Línea 942...
942
        $this->setAdminUser();
942
        $this->setAdminUser();
943
 
943
 
Línea 965... Línea 965...
965
        $this->assertStringContainsString('value12', $res->content);
965
        $this->assertStringContainsString('value12', $res->content);
966
        $this->assertStringContainsString('value13', $res->content);
966
        $this->assertStringContainsString('value13', $res->content);
967
        $this->assertStringNotContainsString('value14', $res->content);
967
        $this->assertStringNotContainsString('value14', $res->content);
968
    }
968
    }
Línea 969... Línea 969...
969
 
969
 
970
    public function test_mod_data_get_tagged_records_approval() {
970
    public function test_mod_data_get_tagged_records_approval(): void {
Línea 971... Línea 971...
971
        global $DB;
971
        global $DB;
972
 
972
 
Línea 1022... Línea 1022...
1022
 
1022
 
1023
        $this->assertStringContainsString('value11', $res->content);
1023
        $this->assertStringContainsString('value11', $res->content);
1024
        $this->assertStringContainsString('value21', $res->content);
1024
        $this->assertStringContainsString('value21', $res->content);
Línea 1025... Línea 1025...
1025
    }
1025
    }
1026
 
1026
 
Línea 1027... Línea 1027...
1027
    public function test_mod_data_get_tagged_records_time() {
1027
    public function test_mod_data_get_tagged_records_time(): void {
1028
        global $DB;
1028
        global $DB;
Línea 1081... Línea 1081...
1081
 
1081
 
1082
        $this->assertStringContainsString('value11', $res->content);
1082
        $this->assertStringContainsString('value11', $res->content);
1083
        $this->assertStringContainsString('value21', $res->content);
1083
        $this->assertStringContainsString('value21', $res->content);
Línea 1084... Línea 1084...
1084
    }
1084
    }
1085
 
1085
 
Línea 1086... Línea 1086...
1086
    public function test_mod_data_get_tagged_records_course_enrolment() {
1086
    public function test_mod_data_get_tagged_records_course_enrolment(): void {
1087
        global $DB;
1087
        global $DB;
Línea 1135... Línea 1135...
1135
 
1135
 
1136
        $this->assertStringContainsString('value11', $res->content);
1136
        $this->assertStringContainsString('value11', $res->content);
1137
        $this->assertStringContainsString('value21', $res->content);
1137
        $this->assertStringContainsString('value21', $res->content);
Línea 1138... Línea 1138...
1138
    }
1138
    }
1139
 
1139
 
Línea 1140... Línea 1140...
1140
    public function test_mod_data_get_tagged_records_course_groups() {
1140
    public function test_mod_data_get_tagged_records_course_groups(): void {
1141
        global $DB;
1141
        global $DB;
Línea 1203... Línea 1203...
1203
    }
1203
    }
Línea 1204... Línea 1204...
1204
 
1204
 
1205
    /**
1205
    /**
1206
     * Test check_updates_since callback.
1206
     * Test check_updates_since callback.
1207
     */
1207
     */
1208
    public function test_check_updates_since() {
1208
    public function test_check_updates_since(): void {
1209
        global $DB;
1209
        global $DB;
1210
        $this->resetAfterTest();
1210
        $this->resetAfterTest();
1211
        $this->setAdminUser();
1211
        $this->setAdminUser();
1212
        $course = $this->getDataGenerator()->create_course();
1212
        $course = $this->getDataGenerator()->create_course();
Línea 1273... Línea 1273...
1273
        $updates = data_check_updates_since($cm, $onehourago);
1273
        $updates = data_check_updates_since($cm, $onehourago);
1274
        $this->assertTrue($updates->entries->updated);
1274
        $this->assertTrue($updates->entries->updated);
1275
        $this->assertEqualsCanonicalizing([$datarecor1did, $datarecor2did], $updates->entries->itemids);
1275
        $this->assertEqualsCanonicalizing([$datarecor1did, $datarecor2did], $updates->entries->itemids);
1276
    }
1276
    }
Línea 1277... Línea 1277...
1277
 
1277
 
1278
    public function test_data_core_calendar_provide_event_action_in_hidden_section() {
1278
    public function test_data_core_calendar_provide_event_action_in_hidden_section(): void {
Línea 1279... Línea 1279...
1279
        global $CFG;
1279
        global $CFG;
Línea 1280... Línea 1280...
1280
 
1280
 
Línea 1310... Línea 1310...
1310
 
1310
 
1311
        // Confirm the event is not shown at all.
1311
        // Confirm the event is not shown at all.
1312
        $this->assertNull($actionevent);
1312
        $this->assertNull($actionevent);
Línea 1313... Línea 1313...
1313
    }
1313
    }
1314
 
1314
 
Línea 1315... Línea 1315...
1315
    public function test_data_core_calendar_provide_event_action_for_non_user() {
1315
    public function test_data_core_calendar_provide_event_action_for_non_user(): void {
Línea 1316... Línea 1316...
1316
        global $CFG;
1316
        global $CFG;
Línea 1341... Línea 1341...
1341
 
1341
 
1342
        // Confirm the event is not shown at all.
1342
        // Confirm the event is not shown at all.
1343
        $this->assertNull($actionevent);
1343
        $this->assertNull($actionevent);
Línea 1344... Línea 1344...
1344
    }
1344
    }
1345
 
1345
 
Línea 1346... Línea 1346...
1346
    public function test_data_core_calendar_provide_event_action_open() {
1346
    public function test_data_core_calendar_provide_event_action_open(): void {
Línea 1347... Línea 1347...
1347
        $this->resetAfterTest();
1347
        $this->resetAfterTest();
Línea 1370... Línea 1370...
1370
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
1370
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
1371
        $this->assertEquals(1, $actionevent->get_item_count());
1371
        $this->assertEquals(1, $actionevent->get_item_count());
1372
        $this->assertTrue($actionevent->is_actionable());
1372
        $this->assertTrue($actionevent->is_actionable());
1373
    }
1373
    }
Línea 1374... Línea 1374...
1374
 
1374
 
1375
    public function test_data_core_calendar_provide_event_action_open_for_user() {
1375
    public function test_data_core_calendar_provide_event_action_open_for_user(): void {
Línea 1376... Línea 1376...
1376
        global $CFG;
1376
        global $CFG;
Línea 1377... Línea 1377...
1377
 
1377
 
Línea 1408... Línea 1408...
1408
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
1408
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
1409
        $this->assertEquals(1, $actionevent->get_item_count());
1409
        $this->assertEquals(1, $actionevent->get_item_count());
1410
        $this->assertTrue($actionevent->is_actionable());
1410
        $this->assertTrue($actionevent->is_actionable());
1411
    }
1411
    }
Línea 1412... Línea 1412...
1412
 
1412
 
1413
    public function test_data_core_calendar_provide_event_action_closed() {
1413
    public function test_data_core_calendar_provide_event_action_closed(): void {
Línea 1414... Línea 1414...
1414
        $this->resetAfterTest();
1414
        $this->resetAfterTest();
Línea 1415... Línea 1415...
1415
 
1415
 
Línea 1433... Línea 1433...
1433
 
1433
 
1434
        // No event on the dashboard if module is closed.
1434
        // No event on the dashboard if module is closed.
1435
        $this->assertNull($actionevent);
1435
        $this->assertNull($actionevent);
Línea 1436... Línea 1436...
1436
    }
1436
    }
1437
 
1437
 
Línea 1438... Línea 1438...
1438
    public function test_data_core_calendar_provide_event_action_closed_for_user() {
1438
    public function test_data_core_calendar_provide_event_action_closed_for_user(): void {
Línea 1439... Línea 1439...
1439
        $this->resetAfterTest();
1439
        $this->resetAfterTest();
Línea 1464... Línea 1464...
1464
 
1464
 
1465
        // No event on the dashboard if module is closed.
1465
        // No event on the dashboard if module is closed.
1466
        $this->assertNull($actionevent);
1466
        $this->assertNull($actionevent);
Línea 1467... Línea 1467...
1467
    }
1467
    }
1468
 
1468
 
Línea 1469... Línea 1469...
1469
    public function test_data_core_calendar_provide_event_action_open_in_future() {
1469
    public function test_data_core_calendar_provide_event_action_open_in_future(): void {
Línea 1470... Línea 1470...
1470
        $this->resetAfterTest();
1470
        $this->resetAfterTest();
Línea 1493... Línea 1493...
1493
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
1493
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
1494
        $this->assertEquals(1, $actionevent->get_item_count());
1494
        $this->assertEquals(1, $actionevent->get_item_count());
1495
        $this->assertFalse($actionevent->is_actionable());
1495
        $this->assertFalse($actionevent->is_actionable());
1496
    }
1496
    }
Línea 1497... Línea 1497...
1497
 
1497
 
1498
    public function test_data_core_calendar_provide_event_action_open_in_future_for_user() {
1498
    public function test_data_core_calendar_provide_event_action_open_in_future_for_user(): void {
Línea 1499... Línea 1499...
1499
        global $CFG;
1499
        global $CFG;
Línea 1500... Línea 1500...
1500
 
1500
 
Línea 1531... Línea 1531...
1531
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
1531
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
1532
        $this->assertEquals(1, $actionevent->get_item_count());
1532
        $this->assertEquals(1, $actionevent->get_item_count());
1533
        $this->assertFalse($actionevent->is_actionable());
1533
        $this->assertFalse($actionevent->is_actionable());
1534
    }
1534
    }
Línea 1535... Línea 1535...
1535
 
1535
 
1536
    public function test_data_core_calendar_provide_event_action_no_time_specified() {
1536
    public function test_data_core_calendar_provide_event_action_no_time_specified(): void {
Línea 1537... Línea 1537...
1537
        $this->resetAfterTest();
1537
        $this->resetAfterTest();
Línea 1538... Línea 1538...
1538
 
1538
 
Línea 1559... Línea 1559...
1559
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
1559
        $this->assertInstanceOf('moodle_url', $actionevent->get_url());
1560
        $this->assertEquals(1, $actionevent->get_item_count());
1560
        $this->assertEquals(1, $actionevent->get_item_count());
1561
        $this->assertTrue($actionevent->is_actionable());
1561
        $this->assertTrue($actionevent->is_actionable());
1562
    }
1562
    }
Línea 1563... Línea 1563...
1563
 
1563
 
1564
    public function test_data_core_calendar_provide_event_action_no_time_specified_for_user() {
1564
    public function test_data_core_calendar_provide_event_action_no_time_specified_for_user(): void {
Línea 1565... Línea 1565...
1565
        global $CFG;
1565
        global $CFG;
Línea 1566... Línea 1566...
1566
 
1566
 
Línea 1627... Línea 1627...
1627
    /**
1627
    /**
1628
     * Test the callback responsible for returning the completion rule descriptions.
1628
     * Test the callback responsible for returning the completion rule descriptions.
1629
     * This function should work given either an instance of the module (cm_info), such as when checking the active rules,
1629
     * This function should work given either an instance of the module (cm_info), such as when checking the active rules,
1630
     * or if passed a stdClass of similar structure, such as when checking the the default completion settings for a mod type.
1630
     * or if passed a stdClass of similar structure, such as when checking the the default completion settings for a mod type.
1631
     */
1631
     */
1632
    public function test_mod_data_completion_get_active_rule_descriptions() {
1632
    public function test_mod_data_completion_get_active_rule_descriptions(): void {
1633
        $this->resetAfterTest();
1633
        $this->resetAfterTest();
1634
        $this->setAdminUser();
1634
        $this->setAdminUser();
Línea 1635... Línea 1635...
1635
 
1635
 
1636
        // Two activities, both with automatic completion. One has the 'completionentries' rule, one doesn't.
1636
        // Two activities, both with automatic completion. One has the 'completionentries' rule, one doesn't.
Línea 1663... Línea 1663...
1663
    }
1663
    }
Línea 1664... Línea 1664...
1664
 
1664
 
1665
    /**
1665
    /**
1666
     * An unknown event type should not change the data instance.
1666
     * An unknown event type should not change the data instance.
1667
     */
1667
     */
1668
    public function test_mod_data_core_calendar_event_timestart_updated_unknown_event() {
1668
    public function test_mod_data_core_calendar_event_timestart_updated_unknown_event(): void {
1669
        global $CFG, $DB;
1669
        global $CFG, $DB;
Línea 1670... Línea 1670...
1670
        require_once($CFG->dirroot . "/calendar/lib.php");
1670
        require_once($CFG->dirroot . "/calendar/lib.php");
1671
 
1671
 
Línea 1704... Línea 1704...
1704
    }
1704
    }
Línea 1705... Línea 1705...
1705
 
1705
 
1706
    /**
1706
    /**
1707
     * A DATA_EVENT_TYPE_OPEN event should update the timeavailablefrom property of the data activity.
1707
     * A DATA_EVENT_TYPE_OPEN event should update the timeavailablefrom property of the data activity.
1708
     */
1708
     */
1709
    public function test_mod_data_core_calendar_event_timestart_updated_open_event() {
1709
    public function test_mod_data_core_calendar_event_timestart_updated_open_event(): void {
1710
        global $CFG, $DB;
1710
        global $CFG, $DB;
Línea 1711... Línea 1711...
1711
        require_once($CFG->dirroot . "/calendar/lib.php");
1711
        require_once($CFG->dirroot . "/calendar/lib.php");
1712
 
1712
 
Línea 1761... Línea 1761...
1761
    }
1761
    }
Línea 1762... Línea 1762...
1762
 
1762
 
1763
    /**
1763
    /**
1764
     * A DATA_EVENT_TYPE_CLOSE event should update the timeavailableto property of the data activity.
1764
     * A DATA_EVENT_TYPE_CLOSE event should update the timeavailableto property of the data activity.
1765
     */
1765
     */
1766
    public function test_mod_data_core_calendar_event_timestart_updated_close_event() {
1766
    public function test_mod_data_core_calendar_event_timestart_updated_close_event(): void {
1767
        global $CFG, $DB;
1767
        global $CFG, $DB;
Línea 1768... Línea 1768...
1768
        require_once($CFG->dirroot . "/calendar/lib.php");
1768
        require_once($CFG->dirroot . "/calendar/lib.php");
1769
 
1769
 
Línea 1818... Línea 1818...
1818
    }
1818
    }
Línea 1819... Línea 1819...
1819
 
1819
 
1820
    /**
1820
    /**
1821
     * An unknown event type should not have any limits.
1821
     * An unknown event type should not have any limits.
1822
     */
1822
     */
1823
    public function test_mod_data_core_calendar_get_valid_event_timestart_range_unknown_event() {
1823
    public function test_mod_data_core_calendar_get_valid_event_timestart_range_unknown_event(): void {
1824
        global $CFG;
1824
        global $CFG;
Línea 1825... Línea 1825...
1825
        require_once($CFG->dirroot . "/calendar/lib.php");
1825
        require_once($CFG->dirroot . "/calendar/lib.php");
1826
 
1826
 
Línea 1856... Línea 1856...
1856
    }
1856
    }
Línea 1857... Línea 1857...
1857
 
1857
 
1858
    /**
1858
    /**
1859
     * The open event should be limited by the data's timeclose property, if it's set.
1859
     * The open event should be limited by the data's timeclose property, if it's set.
1860
     */
1860
     */
1861
    public function test_mod_data_core_calendar_get_valid_event_timestart_range_open_event() {
1861
    public function test_mod_data_core_calendar_get_valid_event_timestart_range_open_event(): void {
1862
        global $CFG;
1862
        global $CFG;
Línea 1863... Línea 1863...
1863
        require_once($CFG->dirroot . "/calendar/lib.php");
1863
        require_once($CFG->dirroot . "/calendar/lib.php");
1864
 
1864
 
Línea 1901... Línea 1901...
1901
    }
1901
    }
Línea 1902... Línea 1902...
1902
 
1902
 
1903
    /**
1903
    /**
1904
     * The close event should be limited by the data's timeavailablefrom property, if it's set.
1904
     * The close event should be limited by the data's timeavailablefrom property, if it's set.
1905
     */
1905
     */
1906
    public function test_mod_data_core_calendar_get_valid_event_timestart_range_close_event() {
1906
    public function test_mod_data_core_calendar_get_valid_event_timestart_range_close_event(): void {
Línea 1907... Línea 1907...
1907
        global $CFG;
1907
        global $CFG;
Línea 1908... Línea 1908...
1908
 
1908
 
Línea 1947... Línea 1947...
1947
    }
1947
    }
Línea 1948... Línea 1948...
1948
 
1948
 
1949
    /**
1949
    /**
1950
     * A user who does not have capabilities to add events to the calendar should be able to create an database.
1950
     * A user who does not have capabilities to add events to the calendar should be able to create an database.
1951
     */
1951
     */
1952
    public function test_creation_with_no_calendar_capabilities() {
1952
    public function test_creation_with_no_calendar_capabilities(): void {
1953
        $this->resetAfterTest();
1953
        $this->resetAfterTest();
1954
        $course = self::getDataGenerator()->create_course();
1954
        $course = self::getDataGenerator()->create_course();
1955
        $context = \context_course::instance($course->id);
1955
        $context = \context_course::instance($course->id);
1956
        $user = self::getDataGenerator()->create_and_enrol($course, 'editingteacher');
1956
        $user = self::getDataGenerator()->create_and_enrol($course, 'editingteacher');
Línea 2088... Línea 2088...
2088
     * @dataProvider data_append_new_field_to_templates_provider
2088
     * @dataProvider data_append_new_field_to_templates_provider
2089
     * @param bool $hasfield if the field is present in the templates
2089
     * @param bool $hasfield if the field is present in the templates
2090
     * @param bool $hasotherfields if the field is not present in the templates
2090
     * @param bool $hasotherfields if the field is not present in the templates
2091
     * @param bool $expected the expected return
2091
     * @param bool $expected the expected return
2092
     */
2092
     */
2093
    public function test_data_append_new_field_to_templates(bool $hasfield, bool $hasotherfields, bool $expected) {
2093
    public function test_data_append_new_field_to_templates(bool $hasfield, bool $hasotherfields, bool $expected): void {
2094
        global $DB;
2094
        global $DB;
2095
        $this->resetAfterTest();
2095
        $this->resetAfterTest();
2096
        $this->setAdminUser();
2096
        $this->setAdminUser();
Línea 2097... Línea 2097...
2097
 
2097
 
Línea 2172... Línea 2172...
2172
     * @param string $type
2172
     * @param string $type
2173
     * @param string $expected
2173
     * @param string $expected
2174
     * @covers \data_get_field_new
2174
     * @covers \data_get_field_new
2175
     * @dataProvider format_parser_provider
2175
     * @dataProvider format_parser_provider
2176
     */
2176
     */
2177
    public function test_create_field(string $type, string $expected) {
2177
    public function test_create_field(string $type, string $expected): void {
2178
        $this->resetAfterTest();
2178
        $this->resetAfterTest();
2179
        $this->setAdminUser();
2179
        $this->setAdminUser();
2180
        $generator = $this->getDataGenerator();
2180
        $generator = $this->getDataGenerator();
2181
        $course = $generator->create_course();
2181
        $course = $generator->create_course();